/* ════════════════════════════════════════════════════════════════
   CITA CRM — Shared Stylesheet
   8-point spacing grid:  --s1=4  --s2=8  --s3=12  --s4=16
                          --s5=20 --s6=24 --s8=32  --s10=40
════════════════════════════════════════════════════════════════ */

/* ─── 1. RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }

/* ─── 2. TOKENS ─── */
:root {
  /* Palette */
  --blue:   #28A8D8;  --blue-h:  #1A90BA;  --blue-l:  #E8F6FC;  --blue-m: #B8DCF0;
  --navy:   #0D1F35;  --sand:    #F4F8FB;  --sand2:   #D8E8F0;
  --stone:  #6E8399;  --body:    #243040;  --white:   #ffffff;
  --gold:   #C8941A;  --gold-l:  #FEF3DC;
  --green:  #0B8A4A;  --green-l: #E1F5EE;
  --red:    #C0392B;  --red-l:   #FDECEB;
  --pur:    #534AB7;  --pur-l:   #EEF2FF;

  /* Fonts */
  --sans:    'Plus Jakarta Sans', system-ui, sans-serif;
  --serif:   'Playfair Display', Georgia, serif;
  --heading: 'DM Sans', system-ui, sans-serif;

  /* Type scale */
  --t-xs:  11px;  --t-sm:  12px;  --t-base: 13px;
  --t-md:  14px;  --t-lg:  16px;  --t-xl:   20px;
  --t-2xl: 24px;  --t-3xl: 32px;

  /* 8-point spacing */
  --s1:  4px;   --s2:  8px;   --s3: 12px;   --s4: 16px;
  --s5: 20px;   --s6: 24px;   --s8: 32px;   --s10: 40px;

  /* Radius */
  --r-sm: 6px;  --r: 8px;  --r-md: 10px;  --r-lg: 12px;

  /* Control height */
  --ctrl-h: 40px;

  /* Layout */
  --sb-w: 240px;
  --tb-h: 60px;
  --rp-w: 292px;
}

/* ─── 3. BASE ─── */
html  { scroll-behavior: smooth; min-height: 100% }
body  {
  font-family: var(--sans); font-size: var(--t-base);
  line-height: 1.55; color: var(--body);
  background: var(--sand); min-height: 100vh; overflow-x: hidden;
}
::-webkit-scrollbar { width: 4px; height: 4px }
::-webkit-scrollbar-thumb { background: var(--sand2); border-radius: 4px }

.icon-tabler {
  color: #6E8399;
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
}

/* ─── 4. TOASTR ─── */
#toast-container > div {
  font-family: var(--sans) !important;
  font-size: var(--t-base) !important;
  border-radius: var(--r) !important;
  box-shadow: 0 4px 20px rgba(13,31,53,.12) !important;
  padding: var(--s3) var(--s4) var(--s3) 52px !important;
  opacity: 1 !important; min-width: 280px !important;
}
#toast-container > .toast-success { background: var(--green) !important }
#toast-container > .toast-error   { background: var(--red)   !important }
#toast-container > .toast-warning { background: var(--gold)  !important }
#toast-container > .toast-info    { background: var(--blue)  !important }
#toast-container > div::before    { font-size: 16px !important; line-height: 1 !important }
.toast-title   { font-weight: 600 !important; font-size: var(--t-sm) !important; margin-bottom: 2px }
.toast-message { font-weight: 500; line-height: 1.4 }

/* ─── 5. SELECT2 ─── */
/* Hide native <select> — Select2 replaces it with its own UI */
.form-select { position: absolute; visibility: hidden; z-index: -1 }
.select2-container { width: 100% !important }

/* ── Спільна база (single та multiple) ── */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  font-family: var(--sans) !important; font-size: var(--t-base) !important;
  border: 1px solid var(--sand2) !important; border-radius: var(--r) !important;
  background: var(--white) !important; min-height: var(--ctrl-h) !important;
  transition: border-color .15s, box-shadow .15s !important;
}
/* ── Single ── */
.select2-container--default .select2-selection--single {
  display: flex !important; align-items: center !important;
  padding: 0 var(--s3) !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--body) !important; font-family: var(--sans) !important;
  font-size: var(--t-base) !important; line-height: var(--ctrl-h) !important;
  padding-left: 0 !important; flex: 1 !important;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--stone) !important }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px !important; right: var(--s2) !important }
.select2-container--default .select2-selection--single .select2-selection__arrow b { border-color: var(--stone) transparent transparent !important }
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b { border-color: transparent transparent var(--blue) !important }

/* ── Multiple ── */
.select2-container--default .select2-selection--multiple {
  padding: 5px var(--s3) !important; cursor: text !important;
  align-items: flex-start !important; height: auto !important;
}
/* Контейнер chips + inline пошук */
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
  display: flex !important; flex-wrap: wrap !important; align-items: center !important;
  gap: 4px !important; padding: 0 !important; margin: 0 !important;
  width: 100% !important; list-style: none !important;
}
/* Chip (вибраний елемент) */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  display: inline-flex !important; align-items: center !important;
  background: var(--blue-l) !important; border: 1px solid var(--blue-m) !important;
  border-radius: var(--r-sm) !important; color: var(--blue-h) !important;
  font-size: var(--t-xs) !important; font-weight: 500 !important;
  padding: 3px 8px !important; margin: 0 !important; line-height: 1.4 !important;
  max-width: 200px !important; white-space: nowrap !important; overflow: hidden !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
  overflow: hidden !important; text-overflow: ellipsis !important; padding-left: 1rem !important;
}
/* Кнопка видалення × */
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  width: 16px !important; height: 100% !important; flex-shrink: 0 !important;
  color: var(--blue-h) !important; opacity: .55 !important;
  font-size: 15px !important; line-height: 1 !important;
  margin-right: 6px !important; padding: 0 !important; cursor: pointer !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  opacity: 1 !important; color: var(--red) !important;
}
/* Inline пошук всередині multiple (головна проблема!) */
.select2-search--inline {
  display: inline-flex !important; align-items: center !important;
  min-width: 80px !important; flex: 1 !important;
}
.select2-search--inline .select2-search__field {
  font-family: var(--sans) !important; font-size: var(--t-base) !important;
  color: var(--body) !important; border: none !important; box-shadow: none !important;
  outline: none !important; background: transparent !important;
  padding: 2px 0 !important; margin: 0 !important;
  width: 100% !important; min-width: 80px !important; line-height: 1.4 !important;
}
.select2-search--inline .select2-search__field::placeholder { color: var(--stone) !important }

/* ── Focus / open ── */
.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(--blue) !important;
  box-shadow: 0 0 0 3px rgba(40,168,216,.15) !important;
  outline: none !important;
}

/* ── Dropdown ── */
.select2-dropdown {
  font-family: var(--sans) !important; font-size: var(--t-base) !important;
  border: 1px solid var(--sand2) !important; border-radius: var(--r) !important;
  box-shadow: 0 8px 24px rgba(13,31,53,.1) !important; overflow: hidden !important;
}
.select2-container--default .select2-results__option { padding: var(--s2) var(--s3) !important; color: var(--body) !important }
/* Вже вибраний елемент — блакитний (клас і aria-атрибут) */
.select2-container--default .select2-results__option--selected,
.select2-container--default .select2-results__option[aria-selected=true] {
  background: var(--blue-m) !important; color: var(--blue-h) !important; font-weight: 500 !important;
  border-left: 2px solid var(--blue) !important; padding-left: calc(var(--s3) - 2px) !important;
}
/* Hover на звичайному елементі */
.select2-container--default .select2-results__option--highlighted:not(.select2-results__option--selected):not([aria-selected=true]) {
  background: var(--blue-l) !important; color: var(--navy) !important;
}
/* Hover на вже вибраному елементі */
.select2-container--default .select2-results__option--highlighted.select2-results__option--selected,
.select2-container--default .select2-results__option--highlighted[aria-selected=true] {
  background: rgba(40,168,216,.35) !important; color: var(--blue-h) !important;
}
/* Пошук у dropdown (single select) */
.select2-search--dropdown .select2-search__field {
  font-family: var(--sans) !important; font-size: var(--t-sm) !important;
  border: 1px solid var(--sand2) !important; border-radius: var(--r-sm) !important;
  padding: var(--s2) var(--s3) !important; color: var(--body) !important; outline: none !important;
}
.select2-search--dropdown .select2-search__field:focus { border-color: var(--blue) !important; box-shadow: 0 0 0 3px rgba(40,168,216,.12) !important }

/* ── Validation ── */
.s2-err .select2-selection--single,
.s2-err .select2-selection--multiple { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(192,57,43,.12) !important }

/* ─── 6. FORM ELEMENTS ─── */
.form-group  { display: flex; flex-direction: column; gap: 5px; margin-bottom: var(--s3) }
.form-group.mb0 { margin-bottom: 0 }
.form-label  { font-size: var(--t-sm); font-weight: 500; color: var(--navy) }
.form-label .req { color: var(--red); margin-left: 2px }
.form-hint   { font-size: var(--t-xs); color: var(--stone); line-height: 1.4 }

/* Input with icon / toggle wrapper */
.input-wrap { position: relative }
.input-icon {
  position: absolute; left: var(--s3); top: 50%; transform: translateY(-50%);
  color: var(--stone); display: flex; align-items: center; pointer-events: none;
}

.form-control {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--dark);
  background: var(--white);
  border: 1px solid var(--sand2);
  border-radius: 8px;
  padding: 0 var(--s3);
  height: 40px;
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-control.has-icon   { padding-left: 40px }
.form-control.has-toggle { padding-right: 44px }
.form-control:focus      { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40,168,216,.15) }
.form-control.is-invalid { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(192,57,43,.12) !important }
.form-control.is-valid   { border-color: var(--green) !important }
.form-control::placeholder { color: var(--gray) }
textarea.form-control    {
  height: auto;
  padding: var(--s3) var(--s3);
  resize: vertical;
  min-height: 88px;
  line-height: 1.6;
  border-radius: 8px;
}

.invalid-feedback { font-size: var(--t-xs); color: var(--red); display: none; margin-top: 3px; line-height: 1.4 }
.invalid-feedback.show { display: block }

.form-check { display: flex; align-items: flex-start; gap: var(--s2); cursor: pointer }
.form-check input[type=checkbox] {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; margin-top: 1px;
  border: 1.5px solid var(--sand2); border-radius: 4px;
  background: var(--white); transition: background .15s, border-color .15s; position: relative;
}
.form-check input[type=checkbox]:checked { background: var(--blue); border-color: var(--blue) }
.form-check input[type=checkbox]:checked::after {
  content: ''; position: absolute;
  left: 3px; top: 1px; width: 6px; height: 9px;
  border: 2px solid #fff; border-top: none; border-left: none; transform: rotate(45deg);
}
.form-check input[type=checkbox]:focus { box-shadow: 0 0 0 3px rgba(40,168,216,.18); outline: none }
.form-check-label { font-size: var(--t-sm); color: var(--body); cursor: pointer; line-height: 1.5 }
.form-check-label a { color: var(--blue); text-decoration: none }
.form-check-label a:hover { color: var(--blue-h) }

/* Radio buttons */
.form-check input[type=radio] {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; margin-top: 1px;
  border: 1.5px solid var(--sand2); border-radius: 50%;
  background: var(--white); transition: background .15s, border-color .15s; position: relative;
}
.form-check input[type=radio]:checked { border-color: var(--blue); border-width: 4px }
.form-check input[type=radio]:focus  { box-shadow: 0 0 0 3px rgba(40,168,216,.18); outline: none }

/* Inline radio/checkbox group */
.form-check-group { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); padding-top: var(--s1) }

/* File input */
.file-input-wrap { position: relative }
.file-input-wrap input[type=file] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; z-index: 2;
}
.file-input-ui {
  display: flex; align-items: center; gap: var(--s3);
  border: 1px dashed var(--sand2); border-radius: var(--r);
  padding: var(--s3) var(--s4); background: var(--sand);
  transition: border-color .15s, background .15s; cursor: pointer;
}
.file-input-wrap:hover .file-input-ui,
.file-input-wrap:focus-within .file-input-ui {
  border-color: var(--blue); background: var(--blue-l);
}
.file-input-btn {
  display: flex; align-items: center; gap: var(--s2);
  background: var(--white); border: 1px solid var(--sand2);
  border-radius: var(--r-sm); padding: 0 var(--s3); height: 30px;
  font-size: var(--t-sm); font-weight: 500; color: var(--navy);
  white-space: nowrap; flex-shrink: 0;
  transition: border-color .15s;
}
.file-input-wrap:hover .file-input-btn { border-color: var(--blue); color: var(--blue) }
.file-input-name {
  font-size: var(--t-sm); color: var(--stone); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}

/* Avatar preview */
.avatar-preview {
  position: relative; width: 96px; height: 96px; flex-shrink: 0;
}
.avatar-preview img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--sand2);
}

.form-grid   { display: grid; gap: var(--s3) }
.form-grid-2 { grid-template-columns: 1fr 1fr }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr }
.form-grid-4 { grid-template-columns: repeat(4, 1fr) }
@media (max-width: 640px) { .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr } }

.form-actions { display: flex; align-items: center; gap: var(--s3); padding-top: var(--s1); flex-wrap: wrap }
.form-actions .spacer { flex: 1 }

/* ─── 7. BUTTONS ─── */
.btn {
  font-family: var(--sans); font-size: var(--t-base); font-weight: 600;
  height: var(--ctrl-h); padding: 0 var(--s5); border-radius: var(--r);
  border: none; cursor: pointer; transition: all .15s;
  display: inline-flex; align-items: center; gap: var(--s2);
  white-space: nowrap; text-decoration: none; line-height: 1;
  align-self: flex-start;
}
.btn-primary   { background: var(--blue);  color: #fff }
.btn-primary:hover  { background: var(--blue-h) }
.btn-secondary { background: var(--white); color: var(--navy); border: 1px solid var(--sand2) }
.btn-secondary:hover { background: var(--sand); border-color: var(--stone) }
.btn-danger    { background: var(--red-l); color: var(--red); border: 1px solid #f5c6c2 }
.btn-danger:hover { background: #f5c6c2 }
.btn-sm  { font-size: var(--t-xs); height: 32px; padding: 0 var(--s3) }
.btn-block { width: 100%; justify-content: center; align-self: stretch }
.btn:disabled { opacity: .5; cursor: not-allowed }

/* Full-width submit (auth pages) */
.btn-submit {
  font-family: var(--sans); font-size: var(--t-base); font-weight: 600;
  height: var(--ctrl-h); width: 100%; border-radius: var(--r);
  border: none; cursor: pointer; background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  transition: background .15s; margin-top: var(--s5);
}
.btn-submit:hover    { background: var(--blue-h) }
.btn-submit:disabled { opacity: .6; cursor: not-allowed }
.btn-submit.mt3 { margin-top: var(--s3) }

/* Ghost / SSO button */
.btn-ghost {
  font-family: var(--sans); font-size: var(--t-sm); font-weight: 500;
  height: var(--ctrl-h); width: 100%; border-radius: var(--r);
  border: 1px solid var(--sand2); cursor: pointer;
  background: var(--white); color: var(--navy);
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  transition: all .15s; margin-top: var(--s3);
}
.btn-ghost:hover { background: var(--sand); border-color: var(--stone) }

/* ─── 8. CHIPS ─── */
.chip         { font-size: var(--t-xs); font-weight: 500; padding: 3px var(--s2); border-radius: var(--r-sm); white-space: nowrap; display: inline-block }
.chip-active  { background: var(--blue-l);  color: var(--blue-h) }
.chip-pending { background: var(--gold-l);  color: var(--gold) }
.chip-new     { background: var(--green-l); color: var(--green) }
.chip-archive { background: var(--sand);    color: var(--stone);  border: 1px solid var(--sand2) }

/* ─── 9. UTILITIES ─── */

/* Back link (used in login & auth) */
.back-link {
  display: inline-flex; align-items: center; gap: var(--s1);
  font-size: var(--t-sm); color: var(--stone); cursor: pointer;
  margin-bottom: var(--s5); transition: color .15s;
  background: none; border: none; padding: 0; font-family: var(--sans);
}
.back-link:hover { color: var(--navy) }

/* Eye toggle */
.eye-toggle {
  position: absolute; right: var(--s3); top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--stone);
  display: flex; align-items: center; padding: var(--s1);
  border-radius: var(--r-sm); transition: color .15s;
}
.eye-toggle:hover { color: var(--navy) }

/* Loading spinner */
.spinner {
  display: none; width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.3); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* Divider (used in login) */
.divider { display: flex; align-items: center; gap: var(--s3); margin: var(--s5) 0 }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--sand2) }
.divider-text { font-size: var(--t-xs); color: var(--stone); white-space: nowrap }

/* Success block (login & auth panels) */
.success-block { text-align: center; padding: var(--s5) 0 var(--s3) }
.success-icon  {
  width: 60px; height: 60px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--s4);
}
.success-icon.green { background: var(--green-l) }
.success-icon.blue  { background: var(--blue-l) }
.success-title { font-family: var(--heading); font-size: var(--t-xl); font-weight: 700; color: var(--navy); letter-spacing: -.02em; margin-bottom: var(--s2) }
.success-desc  { font-size: var(--t-sm); color: var(--stone); line-height: 1.65; max-width: 320px; margin: 0 auto }
.success-email { font-weight: 600; color: var(--navy) }

/* Password strength */
.pw-strength { margin-top: var(--s2) }
.pw-bars     { display: flex; gap: 3px; margin-bottom: 4px }
.pw-bar      { flex: 1; height: 3px; border-radius: 2px; background: var(--sand2); transition: background .3s }
.pw-bar.weak   { background: var(--red) }
.pw-bar.fair   { background: var(--gold) }
.pw-bar.strong { background: var(--green) }
.pw-label    { font-size: 10px; color: var(--stone) }

/* Password requirements list */
.pw-requirements { list-style: none; display: flex; flex-direction: column; gap: var(--s1) }
.req-item { display: flex; align-items: center; gap: 6px }
.req-item span { font-size: var(--t-xs); color: var(--stone) }
.req-item.ok svg circle { stroke: var(--green); fill: var(--green-l) }
.req-item.ok span { color: var(--green) }

/* Forgot / reset link */
.forgot-link { font-size: var(--t-sm); color: var(--blue); text-decoration: none; transition: color .15s }
.forgot-link:hover { color: var(--blue-h) }

/* Page bottom */
.page-bottom { margin-top: var(--s5); text-align: center; font-size: 10px; color: var(--stone); opacity: .7 }

/* ─── 10. SPLIT LAYOUT (login & register pages) ─── */
.page-login,
.page-auth { display: flex; width: 100%; min-height: 100vh }

/* Left decorative panel */
.panel-left {
  flex: 0 0 460px; background: var(--navy);
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.panel-left::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 40px 40px; pointer-events: none;
}
.panel-left-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  height: 100%; padding: var(--s8) var(--s8) var(--s10);
}

/* Decorative blobs */
.blob { position: absolute; border-radius: 50%; pointer-events: none }
.blob-1 { width: 480px; height: 480px; background: radial-gradient(circle, rgba(40,168,216,.18) 0%, transparent 70%); top: -120px; right: -120px }
.blob-2 { width: 320px; height: 320px; background: radial-gradient(circle, rgba(200,148,26,.10) 0%, transparent 70%); bottom: -60px; left: -60px }
.blob-3 { width: 200px; height: 200px; background: radial-gradient(circle, rgba(40,168,216,.12) 0%, transparent 70%); bottom: 160px; right: 40px }

/* Right content panel */
.panel-right {
  flex: 1; background: var(--sand);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--s8) var(--s5); min-height: 100vh;
}

/* ─── 11. LEFT PANEL CONTENT ─── */
.left-logo { display: flex; align-items: center; gap: var(--s3) }
.left-logo-mark {
  width: 40px; height: 40px; border-radius: var(--r-md); background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--serif); font-style: italic; font-size: 18px; flex-shrink: 0;
}
.left-logo-name { font-family: var(--heading); font-size: var(--t-md); font-weight: 700; color: #fff; line-height: 1.2 }
.left-logo-sub  { font-size: 10px; color: rgba(110,131,153,.85); text-transform: uppercase; letter-spacing: .1em; margin-top: 1px }

.left-hero    { margin-top: auto; padding-bottom: var(--s5) }
.left-tagline { font-family: var(--serif); font-style: italic; font-size: var(--t-xs); color: var(--blue); text-transform: uppercase; letter-spacing: .15em; margin-bottom: var(--s3) }
.left-title   { font-family: var(--serif); font-size: 36px; font-weight: 500; color: #fff; line-height: 1.2; margin-bottom: var(--s4) }
.left-title em { font-style: italic; color: var(--blue) }
.left-desc    { font-size: var(--t-sm); color: rgba(110,131,153,.9); line-height: 1.65; max-width: 320px }

/* Stats row (login page) */
.left-stats {
  display: flex; gap: var(--s6); margin-top: var(--s8);
  padding-top: var(--s6); border-top: 1px solid rgba(255,255,255,.08);
}
.left-stat-num   { font-size: var(--t-2xl); font-weight: 700; color: #fff; line-height: 1 }
.left-stat-label { font-size: var(--t-xs); color: rgba(110,131,153,.85); margin-top: var(--s1); line-height: 1.3 }
.left-stat-div   { width: 1px; background: rgba(255,255,255,.08); align-self: stretch }

/* Steps list (register page) */
.left-steps { display: flex; flex-direction: column; gap: var(--s3); margin-top: var(--s8); padding-top: var(--s6); border-top: 1px solid rgba(255,255,255,.08); list-style: none }
.left-step  { display: flex; align-items: flex-start; gap: var(--s3) }
.left-step-num {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(40,168,216,.2); border: 1px solid rgba(40,168,216,.4);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--blue); margin-top: 1px;
}
.left-step-title { font-size: var(--t-sm); font-weight: 600; color: #fff; margin-bottom: 2px }
.left-step-text  { font-size: var(--t-xs); color: rgba(255,255,255,.7); line-height: 1.5 }

/* Mobile logo (shown when left panel hidden) */
.mobile-logo { display: none; align-items: center; gap: var(--s3); margin-bottom: var(--s8) }
.mobile-logo-mark {
  width: 38px; height: 38px; border-radius: var(--r); background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--serif); font-style: italic; font-size: 17px;
}
.mobile-logo-name { font-family: var(--heading); font-size: var(--t-md); font-weight: 700; color: var(--navy); line-height: 1.2 }
.mobile-logo-sub  { font-size: 10px; color: var(--stone); text-transform: uppercase; letter-spacing: .1em; margin-top: 1px }

/* Login card */
.login-card {
  background: var(--white); border: 1px solid var(--sand2);
  border-radius: var(--r-lg); padding: var(--s8) var(--s8);
  width: 100%; max-width: 420px;
  box-shadow: 0 4px 24px rgba(13,31,53,.06);
}
.login-header { margin-bottom: var(--s6) }
.login-title  {
  font-family: var(--serif); font-size: var(--t-xl);
  font-weight: 500; color: var(--navy); line-height: 1.2;
  margin-bottom: var(--s1);
}
.login-sub { font-size: var(--t-sm); color: var(--stone); line-height: 1.5 }

/* Login meta row (remember + forgot) */
.login-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin: var(--s4) 0;
}

/* Login footer */
.login-footer {
  margin-top: var(--s5); text-align: center;
  font-size: var(--t-sm); color: var(--stone);
}
.login-footer a { color: var(--blue); text-decoration: none }
.login-footer a:hover { color: var(--blue-h) }

/* Responsive */
@media (max-width: 900px) {
  .panel-left { display: none }
  .mobile-logo { display: flex }
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD
═══════════════════════════════════════════════════════════════ */

/* ─── 12. SIDEBAR ─── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sb-w);
  background: var(--white); border-right: 1px solid var(--sand2);
  display: flex; flex-direction: column; z-index: 300;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.sb-overlay { display: none; position: fixed; inset: 0; background: rgba(13,31,53,.4); z-index: 299; opacity: 0; transition: opacity .3s }
.sb-top     { padding: 0 var(--s4); border-bottom: 1px solid var(--sand2); height: var(--tb-h); box-sizing: border-box; display: flex; align-items: center; }

.sb-brand { display: flex; align-items: center; gap: var(--s3); text-decoration: none; }
.sb-mark  {
  width: 38px; height: 38px; border-radius: var(--r); background: var(--blue); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--serif); font-style: italic; font-size: 17px;
}
.sb-name { font-size: var(--t-sm); font-weight: 700; color: var(--navy); line-height: 1.25 }
.sb-sub  { font-size: 10px; color: var(--stone); text-transform: uppercase; letter-spacing: .1em; margin-top: 2px }

.sb-search {
  display: flex; align-items: center; gap: var(--s2);
  background: var(--sand); border: 1px solid var(--sand2);
  border-radius: var(--r); padding: 0 var(--s3); height: 36px;
}
.sb-search input { background: none; border: none; outline: none; font-family: var(--sans); font-size: var(--t-sm); color: var(--body); width: 100% }

.sb-nav   { flex: 1; padding: var(--s6) 0 var(--s2) 0; overflow-y: auto }
.sb-group { font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--stone); padding: var(--s3) var(--s4) var(--s1) }
.sb-link  {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s2) var(--s4); min-height: 38px;
  color: var(--stone); cursor: pointer; font-size: var(--t-sm);
  border-left: 2px solid transparent; transition: all .15s; text-decoration: none;
}
.sb-link:hover  { color: var(--navy); background: var(--sand) }
.sb-link.active { color: var(--navy); background: var(--sand); border-left-color: var(--blue); font-weight: 600 }
.sb-link.active .icon-tabler { color: var(--navy); }
.sb-count { margin-left: auto; background: var(--sand); border: 1px solid var(--sand2); color: var(--stone); font-size: 10px; padding: 1px var(--s2); border-radius: 10px; line-height: 1.5 }
.sb-count.hi { background: var(--blue-l); border-color: var(--blue-m); color: var(--blue-h) }
.sb-count.sb-count-danger { background: #FEE2E2; border-color: #FECACA; color: #DC2626 }

.sb-footer { padding: var(--s3) var(--s4); border-top: 1px solid var(--blue-l) }
.sb-user   { display: flex; align-items: center; gap: var(--s3) }
.sb-av     {
  width: 34px; height: 34px; border-radius: 50%; background: var(--navy); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: var(--t-xs); font-weight: 700;
}
.sb-uname { font-size: var(--t-sm); font-weight: 500; color: var(--navy) }
.sb-urole { font-size: 10px; color: var(--stone); margin-top: 1px }

/* ─── 13. MAIN / TOPBAR ─── */
.main {
  margin-left: var(--sb-w); min-height: 100vh;
  display: flex; flex-direction: column; transition: margin-left .3s;
}
.topbar {
  position: sticky; top: 0; z-index: 200; background: var(--white);
  border-bottom: 1px solid var(--sand2); height: var(--tb-h);
  display: flex; align-items: center; justify-content: end; padding: 0 var(--s6); gap: var(--s3);
}
.tb-burger {
  display: none; width: 36px; height: 36px; border-radius: var(--r);
  background: var(--sand); border: 1px solid var(--sand2); cursor: pointer;
  align-items: center; justify-content: center; justify-self: start; flex-direction: column; gap: 5px; flex-shrink: 0;
}
.tb-burger span { display: block; width: 16px; height: 1.5px; background: var(--navy); border-radius: 2px }
.tb-title  { font-family: var(--heading); font-size: var(--t-lg); color: var(--navy); font-weight: 600; letter-spacing: -.01em; flex: 1; margin: 0 }
.tb-search {
  display: flex; align-items: center; gap: var(--s2); background: var(--sand);
  border: 1px solid var(--sand2); border-radius: var(--r); padding: 0 var(--s3);
  height: 36px; flex: 0 0 220px;
}
.tb-search input { background: none; border: none; outline: none; font-family: var(--sans); font-size: var(--t-sm); color: var(--body); width: 100% }
.tb-notif {
  width: 36px; height: 36px; background: var(--sand); border: 1px solid var(--sand2);
  border-radius: var(--r); display: flex; align-items: center; justify-content: center;
  position: relative; cursor: pointer; flex-shrink: 0;
}
.tb-notif-dot { width: 7px; height: 7px; background: var(--blue); border-radius: 50%; position: absolute; top: 7px; right: 7px; border: 1.5px solid var(--white) }
.tb-btn {
  background: var(--blue); color: #fff; font-family: var(--sans);
  font-size: var(--t-sm); font-weight: 600; height: 36px; padding: 0 var(--s4);
  border-radius: var(--r); border: none; cursor: pointer; white-space: nowrap;
  transition: background .15s; flex-shrink: 0;
}
.tb-btn:hover { background: var(--blue-h) }

/* ─── 14. TOPBAR DROPDOWNS ─── */
.tb-user-btn {
  display: flex; align-items: center; gap: var(--s2); cursor: pointer;
  padding: var(--s1) var(--s2); border-radius: var(--r);
  border: 1px solid transparent; transition: all .15s; user-select: none;
  background: none;
}
.tb-user-btn:hover, .tb-user-btn.open { background: var(--sand); border-color: var(--sand2) }
.tb-user-av  {
  width: 32px; height: 32px; border-radius: 50%; background: var(--navy); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: var(--t-xs); font-weight: 700;
}
.tb-user-info { line-height: 1.2 }
.tb-user-name { font-size: var(--t-sm); font-weight: 600; color: var(--navy) }
.tb-user-role { font-size: 10px; color: var(--stone); margin-top: 1px }
.tb-user-chevron { flex-shrink: 0; transition: transform .2s }
.tb-user-btn.open .tb-user-chevron { transform: rotate(180deg) }

.tb-dropdown-wrap { position: relative; flex-shrink: 0 }
.tb-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--white); border: 1px solid var(--sand2); border-radius: var(--r-lg);
  min-width: 280px; box-shadow: 0 8px 32px rgba(13,31,53,.12);
  opacity: 0; pointer-events: none; transform: translateY(-6px);
  transition: opacity .18s, transform .18s; z-index: 400;
}
.tb-dropdown.open { opacity: 1; pointer-events: all; transform: translateY(0) }
.tb-dropdown.lang-dropdown { width: max-content; min-width: max-content; padding: var(--s1) 0 }
.lang-dropdown .dd-item { gap: var(--s2); padding: var(--s2) var(--s3); text-transform: uppercase; white-space: nowrap }
.lang-dropdown .dd-item.active { background: var(--blue-l); color: var(--blue-h); font-weight: 600 }
.lang-dropdown .fi { width: 18px; height: 13px; flex-shrink: 0 }

.dd-header   { display: flex; align-items: center; justify-content: space-between; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--sand2) }
.dd-title    { font-family: var(--heading); font-size: var(--t-sm); font-weight: 600; color: var(--navy); letter-spacing: -.01em }
.dd-mark-all { font-size: var(--t-xs); color: var(--blue); cursor: pointer; transition: color .15s; background: none; border: none; font-family: var(--sans); padding: 0 }
.dd-mark-all:hover { color: var(--blue-h) }

/* Notification list */
.dd-notif-list { list-style: none }
.dd-notif-item {
  display: flex; align-items: flex-start; gap: var(--s2);
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--sand);
  cursor: pointer; transition: background .1s; position: relative;
}
.dd-notif-item:last-of-type { border-bottom: none }
.dd-notif-item:hover { background: var(--sand) }
.dd-notif-item.dd-unread { background: #fafeff }
.dd-notif-item.dd-unread:hover { background: var(--blue-l) }
.dd-notif-av   { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; justify-content: center; font-size: var(--t-xs); font-weight: 600 }
.dd-notif-body { flex: 1; min-width: 0 }
.dd-notif-text { font-size: var(--t-xs); color: var(--body); line-height: 1.45 }
.dd-notif-time { font-size: 10px; color: var(--stone); margin-top: 3px }
.dd-unread-dot { width: 7px; height: 7px; background: var(--blue); border-radius: 50%; flex-shrink: 0; margin-top: 5px }
.dd-footer      { padding: var(--s3) var(--s4); border-top: 1px solid var(--sand2); text-align: center }
.dd-footer-link { font-size: var(--t-xs); color: var(--blue); text-decoration: none }
.dd-footer-link:hover { color: var(--blue-h) }

.dd-user-head  { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s4) var(--s3) }
.dd-user-av    { width: 38px; height: 38px; border-radius: 50%; background: var(--navy); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: var(--t-sm); font-weight: 700 }
.dd-user-name  { font-size: var(--t-sm); font-weight: 600; color: var(--navy) }
.dd-user-email { font-size: var(--t-xs); color: var(--stone); margin-top: 2px }
.dd-divider    { height: 1px; background: var(--sand2); margin: var(--s1) 0 }
.dd-item {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s4); font-size: var(--t-sm);
  color: var(--body); text-decoration: none; cursor: pointer;
  transition: background .1s; min-height: 36px;
}
.dd-item:hover { background: var(--sand); color: var(--navy) }
.dd-item svg   { flex-shrink: 0; color: var(--stone) }
.dd-item:hover svg { color: var(--navy) }
.dd-item-danger     { color: var(--red) }
.dd-item-danger svg { color: var(--red) }
.dd-item-danger:hover { background: var(--red-l); color: var(--red) }
.dd-item-danger:hover svg { color: var(--red) }

/* ─── 15. PAGE SECTIONS ─── */
.page-section        { display: none }
.page-section.active { display: flex; flex: 1 }

.content { flex: 1; min-width: 0; padding: var(--s6); display: flex; flex-direction: column; gap: var(--s5) }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: translateY(0) } }
.content > * { animation: fadeUp .35s ease both }
.content > *:nth-child(1) { animation-delay: .05s }
.content > *:nth-child(2) { animation-delay: .10s }
.content > *:nth-child(3) { animation-delay: .15s }
.content > *:nth-child(4) { animation-delay: .20s }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--s4) }
.kpi-card {
  background: var(--white); border: 1px solid var(--sand2); border-radius: var(--r-md);
  padding: var(--s4) var(--s5); display: flex; gap: var(--s4); align-items: center;
}
.kpi-icon  { width: 46px; height: 46px; border-radius: var(--r); display: flex; align-items: center; justify-content: center; flex-shrink: 0 }
.kpi-val   { font-size: var(--t-2xl); font-weight: 700; color: var(--navy); line-height: 1 }
.kpi-lbl   { font-size: var(--t-xs); color: var(--stone); margin-top: var(--s1) }
.kpi-delta { font-size: var(--t-xs); margin-top: var(--s1) }

/* Table card */
.table-card  { background: var(--white); border: 1px solid var(--sand2); border-radius: var(--r-md); overflow: hidden }
.card-head   { display: flex; align-items: center; justify-content: space-between; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--sand2) }
.card-title  { font-family: var(--heading); font-size: var(--t-md); font-weight: 600; color: var(--navy); letter-spacing: -.01em; margin: 0 }
.card-link   { font-size: var(--t-xs); color: var(--blue); cursor: pointer; text-decoration: none }
.card-link:hover { color: var(--blue-h) }

.filter-bar  { display: flex; gap: var(--s2); padding: var(--s3) var(--s5); border-bottom: 1px solid var(--sand); overflow-x: auto; -webkit-overflow-scrolling: touch }
.filter-chip {
  font-family: var(--sans); font-size: var(--t-xs); padding: var(--s1) var(--s3);
  border-radius: 20px; cursor: pointer; color: var(--stone); background: var(--sand);
  white-space: nowrap; border: 1px solid transparent; transition: all .15s;
}
.filter-chip.on { background: var(--blue-l); color: var(--blue-h); font-weight: 500; border-color: var(--blue-m) }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch }
table.pt    { width: 100%; border-collapse: collapse; min-width: 520px }
.pt thead th {
  font-size: var(--t-xs); color: var(--stone); text-transform: uppercase;
  letter-spacing: .07em; font-weight: 600; text-align: left;
  padding: var(--s2) var(--s5); background: var(--sand); border-bottom: 1px solid var(--sand2);
}
.pt tbody tr  { transition: background .1s; cursor: pointer }
.pt tbody tr:hover { background: var(--sand) }
.pt tbody td  { font-size: var(--t-sm); padding: var(--s3) var(--s5); border-bottom: 1px solid var(--sand); vertical-align: middle; color: var(--body) }
.pt tbody tr:last-child td { border-bottom: none }

.p-av  { width: 34px; height: 34px; border-radius: var(--r); display: flex; align-items: center; justify-content: center; font-size: var(--t-xs); font-weight: 600; flex-shrink: 0; margin-right: var(--s3) }
.p-name { font-size: var(--t-sm); font-weight: 500; color: var(--navy) }
.p-type { font-size: var(--t-xs); color: var(--stone); margin-top: 1px }

.row-more { color: var(--sand2); cursor: pointer; font-size: 17px; transition: color .15s; background: none; border: none; line-height: 1; padding: 0 var(--s2) }
.row-more:hover { color: var(--stone) }

/* ─── 16. RIGHT PANEL ─── */
.right-panel { width: var(--rp-w); flex-shrink: 0; background: var(--white); border-left: 1px solid var(--sand2); display: flex; flex-direction: column; overflow-y: auto }
.rp-section        { padding: var(--s4); border-bottom: 1px solid var(--sand) }
.rp-section:last-child { border-bottom: none }
.rp-title { font-family: var(--heading); font-size: var(--t-sm); font-weight: 600; color: var(--navy); margin: 0 0 var(--s3); letter-spacing: -.01em }

.feed { display: flex; flex-direction: column; list-style: none }
.feed-item { display: flex; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--sand) }
.feed-item:last-child { border-bottom: none }
.feed-av   { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: var(--t-xs); font-weight: 600; margin-top: 1px }
.feed-text { font-size: var(--t-xs); color: var(--body); line-height: 1.45 }
.feed-time { font-size: 10px; color: var(--stone); margin-top: var(--s1) }

.tasks     { display: flex; flex-direction: column; gap: var(--s2); list-style: none }
.task-item { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r); background: var(--sand); border: 1px solid var(--sand2) }
.task-cb   { width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid var(--sand2); flex-shrink: 0 }
.task-cb.done { background: var(--blue); border-color: var(--blue) }
.task-label { font-size: var(--t-xs); flex: 1; line-height: 1.4 }
.task-label.done { color: var(--stone); text-decoration: line-through }
.task-due       { font-size: 10px; color: var(--stone); white-space: nowrap }
.task-due.today { color: var(--gold); font-weight: 500 }

.deliveries { display: flex; flex-direction: column; gap: var(--s2); list-style: none }
.del-item   { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r); background: var(--sand); border: 1px solid var(--sand2) }
.del-icon   { width: 30px; height: 30px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0 }
.del-name   { font-size: var(--t-xs); font-weight: 500; color: var(--navy) }
.del-sub    { font-size: 10px; color: var(--stone); margin-top: 1px }
.del-chip   { font-size: 10px; padding: 2px var(--s2); border-radius: 4px; margin-left: auto; white-space: nowrap }

.region-list { display: flex; flex-direction: column; gap: var(--s3) }
.region-row  { display: flex; align-items: center; gap: var(--s2) }
.region-lbl  { font-size: var(--t-xs); color: var(--stone); width: 78px; flex-shrink: 0 }
.region-track { flex: 1; height: 5px; background: var(--sand); border-radius: 3px }
.region-fill  { height: 5px; border-radius: 3px }
.region-num  { font-size: var(--t-xs); font-weight: 500; color: var(--navy); min-width: 28px; text-align: right }

.mob-panel { display: none; flex-direction: column; gap: var(--s4) }
.mob-card  { background: var(--white); border: 1px solid var(--sand2); border-radius: var(--r-md); padding: var(--s4) var(--s5) }

/* ─── 17. PHONE SELECTOR ─── */
.select-box { position: relative }

.select-box .input-group { display: flex; align-items: stretch }

.select-box .input-group-text {
  display: flex; align-items: center; gap: var(--s1);
  padding: 0 var(--s2); cursor: pointer; user-select: none;
  background: var(--sand); border: 1px solid var(--sand2);
  border-right: none; border-radius: var(--r) 0 0 var(--r);
  height: var(--ctrl-h); flex-shrink: 0;
  transition: background .15s;
}
.select-box .input-group-text:hover { background: var(--sand2) }
.select-box .input-group-text .arrow {
  display: flex; align-items: center; color: var(--stone);
  transition: transform .2s ease;
}
.select-box .input-group-text .arrow svg { width: 18px; height: 18px }
.select-box .input-group-text .arrow.rotate { transform: rotate(180deg) }
.select-box .input-group .form-control { border-radius: 0 var(--r) var(--r) 0; flex: 1 }

.select-box .options {
  display: none; position: absolute; top: calc(var(--ctrl-h) + 4px);
  left: 0; width: 100%; z-index: 200;
}
.select-box .options.active { display: block }

.select-box ol {
  list-style: none; padding: 0; margin: 0;
  background: var(--white); border: 1px solid var(--sand2);
  border-top: none; border-radius: 0 0 var(--r-md) var(--r-md);
  max-height: 260px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(13,31,53,.1);
}
.select-box ol::-webkit-scrollbar { width: 4px }
.select-box ol::-webkit-scrollbar-thumb { background: var(--sand2); border-radius: 4px }

.select-box ol li {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s2); padding: var(--s2) var(--s3); cursor: pointer;
  font-size: var(--t-sm); color: var(--body);
  border-bottom: 1px solid var(--sand);
  transition: background .1s;
}
.select-box ol li:last-child { border-bottom: none }
.select-box ol li:hover { background: var(--sand) }
.select-box ol li.hide { display: none }
.select-box ol li div { display: flex; align-items: center; gap: var(--s2) }
.select-box ol li strong { font-size: var(--t-xs); color: var(--stone); flex-shrink: 0 }

.select-box .search-box {
  border-radius: var(--r-md) var(--r-md) 0 0 !important;
  border-bottom: 1px solid var(--sand2) !important;
  position: sticky; top: 0; z-index: 1;
}
.select-box .search-box:focus { border-color: var(--blue) !important; box-shadow: none !important }

/* ─── 18. FORM PAGES (dashboard) ─── */
.form-page {
  flex: 1; padding: var(--s6) var(--s8) var(--s10);
  display: flex; flex-direction: column; gap: var(--s6);
}
.form-page form { display: flex; flex-direction: column; gap: var(--s5) }
.form-page-title { font-family: var(--heading); font-size: var(--t-xl); color: var(--navy); font-weight: 600; letter-spacing: -.01em; margin: 0 }
.form-page-sub   { font-size: var(--t-sm); color: var(--stone); margin-top: var(--s1); line-height: 1.5 }

.form-card {
  background: var(--white); border: 1px solid var(--sand2); border-radius: var(--r-lg);
  padding: var(--s5) var(--s6); display: flex; flex-direction: column; gap: var(--s4);
}
.form-card-title {
  font-family: var(--heading); font-size: var(--t-md); font-weight: 600; color: var(--navy);
  letter-spacing: -.01em; padding-bottom: var(--s3); border-bottom: 1px solid var(--sand2); margin: 0;
}

/* ─── 18. MODAL ─── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(13,31,53,.45); z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: var(--s5);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: all }
.modal {
  background: var(--white); border-radius: var(--r-lg); width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto; transform: translateY(16px); transition: transform .25s;
  box-shadow: 0 20px 60px rgba(13,31,53,.2);
}
.modal-backdrop.open .modal { transform: translateY(0) }
.modal-header  { display: flex; align-items: center; justify-content: space-between; padding: var(--s5) var(--s6) var(--s4); border-bottom: 1px solid var(--sand2) }
.modal-title   { font-family: var(--heading); font-size: var(--t-lg); font-weight: 600; color: var(--navy); letter-spacing: -.01em; margin: 0 }
.modal-close   { width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--sand); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--stone); transition: all .15s; flex-shrink: 0 }
.modal-close:hover { background: var(--sand2); color: var(--navy) }
.modal-body    { padding: var(--s5) var(--s6); display: flex; flex-direction: column; gap: var(--s4) }
.modal-footer  { padding: var(--s3) var(--s6) var(--s5); display: flex; gap: var(--s2); justify-content: flex-end; border-top: 1px solid var(--sand) }

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════════ */

/* ─── 19. LOGIN CARD ─── */
.login-card {
  background: var(--white); border: 1px solid var(--sand2);
  border-radius: var(--r-lg); padding: var(--s8);
  width: 100%; max-width: 420px;
  box-shadow: 0 4px 24px rgba(13,31,53,.06);
}
.login-header  { margin-bottom: var(--s6) }
.login-title   { font-family: var(--serif); font-size: var(--t-xl); font-weight: 500; color: var(--navy); line-height: 1.2; margin: 0 0 var(--s1) }
.login-sub     { font-size: var(--t-sm); color: var(--stone); line-height: 1.5; margin: 0 }
.login-meta    { display: flex; align-items: center; justify-content: space-between; margin: var(--s4) 0 }
.login-footer  { margin-top: var(--s5); text-align: center; font-size: var(--t-xs); color: var(--stone); line-height: 1.5 }
.login-footer a { color: var(--blue); text-decoration: none }
.login-footer a:hover { color: var(--blue-h) }

/* Login submit button */
.btn-login {
  font-family: var(--sans); font-size: var(--t-base); font-weight: 600;
  height: var(--ctrl-h); width: 100%; border-radius: var(--r);
  border: none; cursor: pointer; background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  transition: background .15s; margin-top: var(--s5);
  position: relative; overflow: hidden;
}
.btn-login:hover    { background: var(--blue-h) }
.btn-login:disabled { opacity: .6; cursor: not-allowed }

/* SSO button */
.btn-sso {
  font-family: var(--sans); font-size: var(--t-sm); font-weight: 500;
  height: var(--ctrl-h); width: 100%; border-radius: var(--r);
  border: 1px solid var(--sand2); cursor: pointer;
  background: var(--white); color: var(--navy);
  display: flex; align-items: center; justify-content: center; gap: var(--s2);
  transition: all .15s;
}
.btn-sso:hover { background: var(--sand); border-color: var(--stone) }

/* Forgot / success panels */
.forgot-panel  { display: none }
.success-panel { display: none; text-align: center; padding: var(--s5) 0 }

/* ═══════════════════════════════════════════════════════════════
   REGISTER / AUTH PAGE
═══════════════════════════════════════════════════════════════ */

/* ─── 20. AUTH CARD & PANELS ─── */
.auth-card {
  background: var(--white); border: 1px solid var(--sand2); border-radius: var(--r-lg);
  width: 100%; max-width: 440px;
  box-shadow: 0 4px 24px rgba(13,31,53,.06);
  overflow: hidden;
}
.auth-panel        { display: none; padding: var(--s8) }
.auth-panel.active { display: block }

.auth-header { margin-bottom: var(--s6) }
.auth-title  { font-family: var(--heading); font-size: var(--t-xl); font-weight: 700; color: var(--navy); line-height: 1.2; letter-spacing: -.02em; margin: 0 0 var(--s1) }
.auth-sub    { font-size: var(--t-sm); color: var(--stone); line-height: 1.55; margin: 0 }

.auth-footer { margin-top: var(--s5); text-align: center; font-size: var(--t-xs); color: var(--stone); line-height: 1.55 }
.auth-footer a { color: var(--blue); text-decoration: none; font-weight: 500 }
.auth-footer a:hover { color: var(--blue-h) }

/* Progress steps bar */
.steps-bar  { display: flex; align-items: center; gap: 0; margin-bottom: var(--s6) }
.step-item  { display: flex; align-items: center; gap: var(--s2) }
.step-dot   {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; transition: all .3s;
}
.step-dot.done   { background: var(--green-l); color: var(--green); border: 1.5px solid var(--green) }
.step-dot.active { background: var(--blue);    color: #fff;          border: 1.5px solid var(--blue) }
.step-dot.idle   { background: var(--sand);    color: var(--stone);  border: 1.5px solid var(--sand2) }
.step-label        { font-size: 10px; color: var(--stone); font-weight: 500; transition: color .3s }
.step-label.active { color: var(--navy); font-weight: 600 }
.step-line         { flex: 1; height: 1px; background: var(--sand2); min-width: 20px; transition: background .3s }
.step-line.done    { background: var(--green) }

/* OTP / verification code inputs */
.code-wrap  { display: flex; gap: var(--s2); justify-content: center; margin: var(--s5) 0 }
.code-input {
  width: 48px; height: 56px; border-radius: var(--r-md);
  border: 1.5px solid var(--sand2); background: var(--white);
  font-family: var(--heading); font-size: var(--t-2xl); font-weight: 700;
  color: var(--navy); text-align: center; outline: none;
  transition: border-color .15s, box-shadow .15s; caret-color: var(--blue);
}
.code-input:focus     { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40,168,216,.15) }
.code-input.filled    { border-color: var(--blue-m); background: var(--blue-l) }
.code-input.is-invalid { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(192,57,43,.12) !important }
.code-resend { font-size: var(--t-xs); color: var(--stone); text-align: center; margin-top: var(--s2) }
.code-resend a { color: var(--blue); text-decoration: none; cursor: pointer }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 1240px) {
  .right-panel { display: none }
  .kpi-grid    { grid-template-columns: repeat(2,1fr) }
  .mob-panel   { display: flex }
}
@media (max-width: 960px) {
  :root { --sb-w: 210px }
  .tb-search { flex: 0 0 180px }
  .content   { padding: var(--s5) }
}
@media (max-width: 900px) {
  .panel-left  { display: none }
  .mobile-logo { display: flex }
}
@media (max-width: 720px) {
  :root { --sb-w: 260px; --tb-h: 56px }
  .sidebar { transform: translateX(-100%) }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(13,31,53,.12) }
  .sb-overlay { display: block }
  .main        { margin-left: 0 }
  .tb-burger   { display: flex }
  .tb-search   { display: none }
  .tb-user-info, .tb-user-chevron { display: none }
  .content     { padding: var(--s4); gap: var(--s4) }
  .form-page   { padding: var(--s4) var(--s4) var(--s8) }
  .form-card   { padding: var(--s4) }
  .kpi-grid    { grid-template-columns: repeat(2,1fr); gap: var(--s3) }
  .kpi-card    { padding: var(--s3) var(--s4) }
  .kpi-icon    { width: 40px; height: 40px }
  .kpi-val     { font-size: 22px }
  .topbar      { padding: 0 var(--s4) }
}
@media (max-width: 480px) {
  .login-card  { padding: var(--s5) var(--s4) }
  .auth-panel  { padding: var(--s5) var(--s4) }
  .panel-right { padding: var(--s5) var(--s3) }
  .code-input  { width: 40px; height: 48px; font-size: var(--t-xl) }
  .tb-dropdown { min-width: 260px }
  .tb-dropdown.lang-dropdown { min-width: max-content }
  .form-page         { padding: var(--s4) var(--s3) var(--s8) }
  .form-page-title   { font-size: var(--t-lg) }
  .form-actions      { flex-direction: column }
  .form-actions .btn { width: 100%; justify-content: center }
}

/* Chevron rotation for accordion */
.chevrone {
  transition: transform 0.25s ease;
  transform: rotate(0deg);
  transform-origin: center;
  cursor: pointer;
}
.chevrone.rotated {
  transform: rotate(90deg);
}

.child-name-link {
  font-size: var(--t-sm);
  color: var(--navy);
  text-decoration: none;
  font-weight: 500;
}
.child-name-link:hover { text-decoration: underline; }

.child-cell-inner {
  height: 48px;
  padding: 0 var(--s5);
  display: flex;
  align-items: center;
  gap: 6px;
  background: #F2F9FD;
  border-bottom: 1px solid var(--blue-m);
  font-size: var(--t-sm);
  color: var(--body);
}

.actions-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--sand2) !important;
  background: transparent !important;
  cursor: pointer;
}

.actions-button:hover {
    border-color: #6E8399 !important;
}

/* Action buttons color coding by function */
.actions-button.action-map {
    color: var(--green);
}
.actions-button.action-map:hover {
    background: rgba(11, 138, 74, 0.1) !important;
    border-color: var(--green) !important;
}

.actions-button.action-add {
    color: var(--gold);
}
.actions-button.action-add:hover {
    background: rgba(200, 148, 26, 0.1) !important;
    border-color: var(--gold) !important;
}

.actions-button.action-edit {
    color: var(--blue);
}
.actions-button.action-edit:hover {
    background: rgba(40, 168, 216, 0.1) !important;
    border-color: var(--blue) !important;
}

.actions-button.action-delete {
    color: var(--red);
}
.actions-button.action-delete:hover {
    background: rgba(192, 57, 43, 0.1) !important;
    border-color: var(--red) !important;
}

/* Icon colors for action buttons */
.actions-button.action-map svg {
    color: var(--green);
    stroke: var(--green);
}

.actions-button.action-add svg {
    color: var(--gold);
    stroke: var(--gold);
}

.actions-button.action-edit svg {
    color: var(--blue);
    stroke: var(--blue);
}

.actions-button.action-delete svg {
    color: var(--red);
    stroke: var(--red);
}

/* Apply background only on hover using CSS variables */
.actions-button.action-map:hover {
    --button-bg: rgba(11, 138, 74, 0.1);
}

.actions-button.action-add:hover {
    --button-bg: rgba(200, 148, 26, 0.1);
}

.actions-button.action-edit:hover {
    --button-bg: rgba(40, 168, 216, 0.1);
}

.actions-button.action-delete:hover {
    --button-bg: rgba(192, 57, 43, 0.1);
}

.actions-button.action-map:hover,
.actions-button.action-add:hover,
.actions-button.action-edit:hover,
.actions-button.action-delete:hover {
    background-color: var(--button-bg, transparent) !important;
}

/* Right align actions column */
.pt th:last-child,
.pt td:last-child {
    text-align: right;
}

.pt td:last-child > div {
    justify-content: flex-end;
}

/* Page Tabs */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s5);
  gap: var(--s3);
}

.page-tabs {
  display: flex;
  align-items: center;
  gap: var(--s2);
  background: var(--white);
  border: 1px solid var(--sand2);
  border-radius: 12px;
  padding: 4px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: var(--s1);
  padding: var(--s2) var(--s3);
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: var(--sand1);
  color: var(--dark);
}

.tab-btn.active {
  background: var(--blue);
  color: var(--white);
}

.tab-count {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.tab-btn.active .tab-count {
  background: rgba(255, 255, 255, 0.3);
}

/* Form Card */
.form-card {
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--sand2);
}

.form-head {
  padding: var(--s5) var(--s6);
  border-bottom: 1px solid var(--sand2);
}

.form-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark);
  margin: 0;
}

.form-body {
  padding: var(--s6);
}

.form-group {
  margin-bottom: var(--s4);
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--dark);
  margin-bottom: var(--s1);
}

.form-hint {
  font-size: 12px;
  color: var(--gray);
  margin: 0 0 var(--s3) 0;
}

.form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: var(--s1);
}

.form-row {
  display: flex;
  gap: var(--s3);
  margin-bottom: var(--s4);
}

.form-col {
  flex: 1;
}

.input-group {
  display: flex;
  align-items: center;
}

.input-prefix {
  display: flex;
  align-items: center;
  padding: 0 var(--s2);
  background: var(--sand1);
  border: 1px solid var(--sand2);
  border-right: none;
  border-radius: 8px 0 0 8px;
  font-size: 12px;
  color: var(--gray);
  height: 40px;
}

.input-group {
  display: flex;
  align-items: center;
  width: 100%;
}

.input-group .form-control {
  flex: 1;
  border-radius: 0 8px 8px 0;
}

.input-group .input-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 var(--s3);
  background: var(--sand1);
  border: 1px solid var(--sand2);
  border-radius: 8px 0 0 8px;
  color: var(--gray);
  font-size: 14px;
  font-weight: 500;
}

.preview-box {
  padding: var(--s4);
  background: var(--sand1);
  border-radius: 8px;
  font-family: Georgia, serif;
  font-size: 16px;
  line-height: 1.4;
  color: var(--dark);
  margin-bottom: var(--s4);
  overflow: hidden;
  max-width: 100%;
}
.preview-box img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.form-section {
  margin-bottom: var(--s5);
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 var(--s3) 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.active {
  background: rgba(34, 197, 94, 0.1);
  color: var(--green);
}

.status-badge.inactive {
  background: rgba(107, 114, 128, 0.1);
  color: var(--gray);
}

/* Minimal Compact Checkbox */
.form-check.compact {
  gap: var(--s1);
}

.form-check.compact input[type=checkbox] {
  width: 16px !important;
  height: 16px !important;
  border-radius: 4px !important;
  border-width: 1.5px !important;
  margin-top: 1px !important;
}

.form-check.compact input[type=checkbox]:checked::after {
  content: ''; position: absolute;
  left: 3px !important; top: 1px !important;
  width: 6px !important; height: 9px !important;
  border: 2px solid #fff !important;
  border-top: none !important; border-left: none !important;
  transform: rotate(45deg) !important;
}

.form-check.compact .form-check-label {
  font-size: 13px !important;
  line-height: 1.3 !important;
}

/* Compact Action Buttons for Tables */
.table-wrap .actions-button {
  width: 24px !important;
  height: 24px !important;
  border-radius: 6px !important;
  padding: 2px !important;
}

.table-wrap .actions-button svg {
  width: 16px !important;
  height: 16px !important;
}


/* Preview Container */
.preview-container {
  border: 2px dashed var(--sand2);
  border-radius: 8px;
  background: var(--sand1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

/* Form Actions */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-top: var(--s5);
  padding-top: var(--s5);
  border-top: 1px solid var(--sand2);
}

/* Page Hint */
.page-hint {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: var(--s4);
  padding: var(--s3) var(--s4);
  background: var(--sand1);
  border-radius: 8px;
  border-left: 3px solid var(--blue);
}

/* Role Permissions */
.permission-card {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--sand2);
  overflow: hidden;
  margin-bottom: var(--s4);
}

.permission-card-head {
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--sand2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.permission-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
  margin: 0;
}

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

.permission-table th {
  background: var(--sand1);
  padding: var(--s3) var(--s4);
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--sand2);
}

.permission-table td {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--sand2);
  font-size: 14px;
  color: var(--dark);
}

.permission-table tr:last-child td {
  border-bottom: none;
}

.permission-name {
  font-weight: 500;
  color: var(--dark);
}

.permission-code {
  display: block;
  font-size: 11px;
  color: var(--gray);
  font-family: 'Courier New', monospace;
  margin-top: 2px;
}

.permission-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.permission-checkbox:hover {
  background: var(--sand1);
  transform: scale(1.05);
}

.permission-checkbox.locked {
  cursor: default;
  opacity: 0.7;
}

.permission-checkbox.locked:hover {
  background: none;
  transform: none;
}

.permission-checkbox svg {
  width: 18px;
  height: 18px;
}

/* Slide Checkbox */
.slide-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.slide-checkbox:hover {
  background: var(--sand1);
  transform: scale(1.05);
}

.slide-checkbox svg {
  width: 18px;
  height: 18px;
}

.role-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.role-badge.admin {
  background: rgba(40, 168, 216, 0.1);
  color: var(--blue);
}

.role-badge.manager {
  background: rgba(245, 166, 35, 0.1);
  color: var(--gold);
}

.role-badge.editor {
  background: rgba(156, 110, 252, 0.1);
  color: var(--purple);
}

.role-badge.user {
  background: rgba(107, 114, 128, 0.1);
  color: var(--gray);
}

/* Pagination Styles */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin: var(--s5) 0;
  padding: 0;
  list-style: none;
}

.pagination .page-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pagination .page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--s3);
  margin: 0 2px;
  border: 1px solid var(--sand2);
  border-radius: 8px;
  background: var(--white);
  color: var(--dark);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.pagination .page-link:hover {
  background: var(--sand1);
  border-color: var(--blue);
  color: var(--blue);
}

.pagination .page-item.active .page-link {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
  font-weight: 600;
}

.pagination .page-item.disabled .page-link {
  background: var(--sand1);
  border-color: var(--sand2);
  color: var(--gray);
  cursor: not-allowed;
  opacity: 0.6;
}

.pagination .page-item.disabled .page-link:hover {
  background: var(--sand1);
  border-color: var(--sand2);
  color: var(--gray);
  transform: none;
}

/* Pagination Navigation */
.pagination nav {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: var(--s5) 0;
}

/* Hide desktop pagination on mobile */
@media (max-width: 767px) {
  .d-flex.justify-content-between > div:last-child {
    display: none !important;
  }

  /* Style mobile pagination */
  .d-flex.justify-content-between > div:first-child .pagination {
    justify-content: center;
    gap: var(--s3);
    margin: var(--s5) 0;
  }

  .d-flex.justify-content-between > div:first-child .page-link {
    min-width: 80px;
    height: 36px;
    font-size: 14px;
    margin: 0;
    padding: 0 var(--s4);
    font-weight: 500;
    border: 1px solid var(--sand2);
    border-radius: 8px;
    background: var(--white);
    color: var(--dark);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .d-flex.justify-content-between > div:first-child .page-link:hover {
    background: var(--sand1);
    border-color: var(--blue);
    color: var(--blue);
  }

  .d-flex.justify-content-between > div:first-child .page-item.disabled .page-link {
    background: var(--sand1);
    border-color: var(--sand2);
    color: var(--gray);
    cursor: not-allowed;
    opacity: 0.6;
  }
}

/* Hide mobile pagination on desktop */
@media (min-width: 768px) {
  .d-flex.justify-content-between > div:first-child {
    display: none !important;
  }

  /* Style desktop pagination */
  .d-flex.justify-content-between > div:last-child .pagination {
    justify-content: center;
    align-items: center;
    gap: var(--s2);
  }

  .d-flex.justify-content-between > div:last-child .page-link {
    min-width: 36px;
    height: 36px;
    font-size: 14px;
    margin: 0 2px;
    padding: 0 var(--s3);
  }

  /* Compact page numbers */
  .d-flex.justify-content-between > div:last-child .page-item:not(.active):not(.disabled) .page-link {
    min-width: 36px;
  }

  /* Wider for prev/next buttons */
  .d-flex.justify-content-between > div:last-child .page-item:first-child .page-link,
  .d-flex.justify-content-between > div:last-child .page-item:last-child .page-link {
    min-width: 80px;
    font-weight: 500;
  }
}
