html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  min-height: 100vh;
}

.app-sidebar {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sidebar-header {
  flex: 0 0 auto;
}

.menu-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.menu-icon.fa-solid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.action-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.btn:has(> .action-icon),
.dropdown-item:has(> .action-icon) {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  white-space: nowrap;
}

.dropdown-item:has(> .action-icon) {
  width: 100%;
}

.btn-sm > .action-icon,
.dropdown-item > .action-icon {
  width: .95rem;
  height: .95rem;
}

.sidebar-nav .nav-link {
  color: #cbd5e1 !important;
}

.sidebar-nav .menu-group-toggle {
  width: 100%;
  border: 0;
  text-align: left;
  background-color: transparent;
  font-weight: 600;
}

.sidebar-nav .menu-group-label {
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-nav .menu-group-indicator {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 1.5rem;
  margin-left: auto;
  color: #e5e7eb;
  border-radius: 50%;
  background-color: transparent;
  transition: background-color .15s ease, color .15s ease;
}

.sidebar-nav .menu-group-indicator-icon {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
  transform: rotate(90deg);
  transition: transform .15s ease;
}

.sidebar-nav .menu-group-toggle[aria-expanded="false"] .menu-group-indicator-icon {
  transform: rotate(-90deg);
}

.sidebar-nav .menu-group-toggle:hover .menu-group-indicator,
.sidebar-nav .menu-group-toggle:focus .menu-group-indicator {
  color: #ffffff;
  background-color: rgba(255, 255, 255, .12);
}

.sidebar-nav .menu-group-toggle.active .menu-group-indicator {
  color: #ffffff;
}

.sidebar-nav .child-nav-link {
  font-size: .95rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link:focus {
  color: #ffffff !important;
  background-color: #1f2937;
}

.sidebar-nav .nav-link.active {
  color: #ffffff !important;
  background-color: #2563eb;
}

.sidebar-nav .btn-outline-secondary {
  color: #e5e7eb;
  border-color: #374151;
  background-color: #111827;
}

.sidebar-nav .btn-outline-secondary:hover,
.sidebar-nav .btn-outline-secondary:focus {
  color: #ffffff;
  border-color: #4b5563;
  background-color: #1f2937;
}

.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.sidebar-menu {
  flex: 1 1 auto;
  flex-wrap: nowrap;
  min-height: 0;
  padding-right: .25rem;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar-menu > .nav-link,
.sidebar-menu > .menu-group-toggle,
.sidebar-menu > .collapse {
  flex: 0 0 auto;
}

.sidebar-menu > .collapse {
  width: 100%;
}

.sidebar-menu .nav {
  flex-wrap: nowrap;
}

.sidebar-footer {
  flex: 0 0 auto;
}

.app-sidebar-collapsed .app-sidebar .sidebar-menu {
  align-items: center;
  overflow-x: hidden;
}

.app-sidebar-collapsed .app-sidebar .sidebar-nav > .mt-auto {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-sidebar-collapsed .app-sidebar .sidebar-nav .nav-link,
.app-sidebar-collapsed .app-sidebar .sidebar-nav .btn-outline-secondary {
  width: 2.75rem !important;
  height: 2.75rem;
  min-height: 2.75rem;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center !important;
  gap: 0 !important;
  overflow: hidden;
  flex: 0 0 2.75rem;
}

.app-sidebar-collapsed .app-sidebar .sidebar-nav .menu-icon {
  width: 1.5rem;
  height: 1.5rem;
}

.app-sidebar-collapsed .app-sidebar .sidebar-nav .menu-icon.fa-solid {
  font-size: 1.35rem;
}

.app-sidebar-collapsed .app-sidebar .sidebar-nav .menu-group-toggle {
  text-align: center;
}

.app-sidebar-collapsed .app-sidebar .sidebar-nav .collapse,
.app-sidebar-collapsed .app-sidebar .sidebar-nav .collapse .nav {
  width: 100%;
}

.app-sidebar-collapsed .app-sidebar .sidebar-nav .collapse .nav {
  align-items: center;
  padding-left: 0 !important;
}

.app-sidebar-collapsed .app-sidebar .sidebar-nav .nav-link > span,
.app-sidebar-collapsed .app-sidebar .sidebar-nav .btn-outline-secondary > span > span,
.app-sidebar-collapsed .app-sidebar .sidebar-nav .dropdown-toggle::after {
  display: none !important;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}


/* ── User card list ─────────────────────────────────── */
.user-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.users-filter {
  flex-wrap: wrap;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.user-card:hover {
  border-color: #adb5bd;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.user-card-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  border-radius: 50%;
  background: #e9ecef;
  color: #495057;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  user-select: none;
}

.user-card-code {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #0d6efd;
  background: #e7f1ff;
  border: 1px solid #b6d4fe;
  border-radius: 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

.user-card-body {
  flex: 1;
  min-width: 0;
}

.user-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #212529;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
  font-size: 0.85rem;
  color: #6c757d;
}

.user-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #0d6efd;
  background: #e7f1ff;
  border-radius: 999px;
  line-height: 1.4;
}

.user-card-email {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-role {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* ── Role card list ─────────────────────────────────── */
.role-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.role-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.role-card:hover {
  border-color: #adb5bd;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.role-card-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  border-radius: 50%;
  background: #e9ecef;
  color: #495057;
  font-size: 0.95rem;
  font-weight: 600;
  user-select: none;
}

.role-card-body {
  flex: 1;
  min-width: 0;
}

.role-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #212529;
  line-height: 1.3;
}

.role-card-meta {
  margin-top: 0.15rem;
  font-size: 0.85rem;
  color: #6c757d;
}

/* ── Role permission groups ──────────────────────────── */
.role-card-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.role-permission-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid transparent;
  background: #f8f9fa;
}

.role-permission-group-name {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  opacity: 0.7;
}

.role-permission-group-icon {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
}

.role-permission-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.role-permission-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.4rem;
  font-size: 0.76rem;
  font-weight: 500;
  border-radius: 999px;
  white-space: nowrap;
}

/* Color variants — border-left accent + tinted background */
.role-group-cargo {
  background: #e7f1ff;
  border-color: #b6d4fe;
}

.role-group-cargo .role-permission-group-name { color: #0550ae; }
.role-group-cargo .role-permission-chip {
  background: #d0e2ff;
  color: #084298;
}

.role-group-bank {
  background: #d1fae5;
  border-color: #a7f3d0;
}

.role-group-bank .role-permission-group-name { color: #065f46; }
.role-group-bank .role-permission-chip {
  background: #a7f3d0;
  color: #064e3b;
}

.role-group-third {
  background: #fff3cd;
  border-color: #ffe69c;
}

.role-group-third .role-permission-group-name { color: #664d03; }
.role-group-third .role-permission-chip {
  background: #ffe69c;
  color: #664d03;
}

.role-group-cash {
  background: #fee2e2;
  border-color: #fecaca;
}

.role-group-cash .role-permission-group-name { color: #991b1b; }
.role-group-cash .role-permission-chip {
  background: #fecaca;
  color: #991b1b;
}

.role-group-admin {
  background: #ede9fe;
  border-color: #d8b4fe;
}

.role-group-admin .role-permission-group-name { color: #5b21b6; }
.role-group-admin .role-permission-chip {
  background: #d8b4fe;
  color: #5b21b6;
}

.role-group-other {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.role-group-other .role-permission-group-name { color: #475569; }
.role-group-other .role-permission-chip {
  background: #e2e8f0;
  color: #334155;
}

@media (max-width: 575px) {
  .role-card-groups {
    flex-direction: column;
    gap: 0.35rem;
  }
}

.role-card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

@media (max-width: 575px) {
  .role-card {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
  }

  .role-card-avatar {
    width: 2.25rem;
    height: 2.25rem;
    min-width: 2.25rem;
    font-size: 0.8rem;
  }

  .role-card-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 0.25rem;
  }
}

/* ── User card (mobile) ─────────────────────────────── */
@media (max-width: 575px) {
  .user-card {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
  }

  .user-card-avatar {
    width: 2.25rem;
    height: 2.25rem;
    min-width: 2.25rem;
    font-size: 0.8rem;
  }

  .user-card-code {
    font-size: 0.76rem;
    padding: 0.1rem 0.4rem;
  }

  .user-card-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 0.25rem;
  }
}

/* Task list */
.tasks-page {
  display: flex;
  flex-direction: column;
}

.tasks-page.entity-cards-layout {
  gap: 0;
}

.tasks-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.75rem;
}

.tasks-toolbar > .btn-group,
.tasks-filter-block {
  order: 1;
}

.tasks-toolbar > .entity-panel-expand-toggle {
  order: 3;
}

.tasks-create-button {
  order: 2;
  margin-left: auto;
}

.tasks-filter-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.tasks-filter-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
}

.tasks-table-wrapper {
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  background: #fff;
}

.tasks-cards-content .tasks-table-wrapper {
  border: 0;
  border-radius: 0;
}

.tasks-list-pane > .alert {
  margin: 1rem;
}

.tasks-table {
  margin-bottom: 0;
}

.tasks-table th {
  font-size: 0.78rem;
  font-weight: 700;
  color: #6c757d;
  text-transform: uppercase;
  white-space: nowrap;
  background: #f8f9fa;
}

.tasks-table .orders-sort-link {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  color: #6c757d;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.tasks-table .orders-sort-link:hover,
.tasks-table .orders-sort-link:focus {
  color: #212529;
  text-decoration: none;
}

.tasks-table td {
  font-size: 0.9rem;
  vertical-align: middle;
}

.tasks-sort-icon {
  position: relative;
  display: inline-block;
  width: .85rem;
  height: .9rem;
  margin-left: .1rem;
  flex: 0 0 auto;
}

.tasks-sort-arrow {
  position: relative;
  display: block;
  width: .5rem;
  height: .38rem;
  color: #cbd5e1;
  transition: color .15s ease;
}

.tasks-sort-arrow.active {
  color: #374151;
}

.tasks-sort-arrow::before {
  content: "";
  position: absolute;
  left: 50%;
  width: 1px;
  height: .3rem;
  background: currentColor;
  transform: translateX(-50%);
}

.tasks-sort-arrow::after {
  content: "";
  position: absolute;
  left: 50%;
  width: .28rem;
  height: .28rem;
  border-color: currentColor;
  border-style: solid;
  transform: translateX(-50%) rotate(45deg);
}

.tasks-sort-arrow-up::before {
  top: .08rem;
}

.tasks-sort-arrow-up {
  position: absolute;
  top: .12rem;
  left: 0;
}

.tasks-sort-arrow-up::after {
  top: .03rem;
  border-width: 1px 0 0 1px;
}

.tasks-sort-arrow-down {
  position: absolute;
  right: 0;
  bottom: .12rem;
}

.tasks-sort-arrow-down::before {
  bottom: .08rem;
}

.tasks-sort-arrow-down::after {
  bottom: .03rem;
  border-width: 0 1px 1px 0;
}

.tasks-subject-cell {
  min-width: 18rem;
}

.tasks-subject {
  font-weight: 600;
  color: #212529;
}

.tasks-notes {
  max-width: 34rem;
  margin-top: 0.15rem;
  color: #6c757d;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tasks-order-cell {
  white-space: nowrap;
}

.tasks-actions-header,
.tasks-actions-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.tasks-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.tasks-status-open {
  background: #e7f1ff;
  color: #084298;
}

.tasks-status-in-progress {
  background: #fff3cd;
  color: #664d03;
}

.tasks-status-completed {
  background: #d1e7dd;
  color: #0f5132;
}

.tasks-status-cancelled {
  background: #f8d7da;
  color: #842029;
}

.tasks-pagination {
  display: flex;
  justify-content: flex-end;
  padding: 0.75rem;
  border-top: 1px solid #dee2e6;
  background: #fff;
}

.tasks-detail-empty-pane {
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 1rem;
}

.tasks-edit-form {
  max-width: 62rem;
}

.tasks-editor-modal .tasks-edit-form {
  max-width: none;
}

.entity-tasks-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
}

.entity-tasks-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.entity-tasks-panel-title {
  font-weight: 700;
  color: #212529;
}

.entity-tasks-panel-count {
  color: #6c757d;
  font-size: 0.82rem;
}

.entity-tasks-alert {
  margin-bottom: 0;
}

.entity-task-create-form,
.entity-task-edit-form {
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 0.85rem;
  background: #fff;
}

.entity-task-create-form .form-label,
.entity-task-edit-form .form-label {
  margin-bottom: 0.25rem;
  color: #495057;
  font-size: 0.78rem;
  font-weight: 700;
}

.entity-task-form-title {
  margin-bottom: 0.7rem;
  color: #212529;
  font-size: 0.9rem;
  font-weight: 700;
}

.entity-task-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.entity-task-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.entity-task-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 0.75rem;
  background: #fff;
}

.entity-task-item-main {
  min-width: 0;
}

.entity-task-item-title {
  color: #212529;
  font-weight: 700;
}

.entity-task-item-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.entity-task-edit-button {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.entity-task-item-notes {
  margin-top: 0.2rem;
  color: #6c757d;
  font-size: 0.85rem;
}

.entity-task-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 0.45rem;
  color: #6c757d;
  font-size: 0.78rem;
}

@media (max-width: 575px) {
  .tasks-toolbar {
    align-items: stretch;
  }

  .tasks-filter-block {
    width: 100%;
  }

  .tasks-filter-label {
    width: 100%;
  }

  .tasks-create-button {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }
}
