#admin-toast-container {
  z-index: 1085;
}

#admin-toast-container .toast {
  pointer-events: auto;
}

body.admin-loading {
  overflow: hidden;
}

.admin-page-loader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

body.admin-loaded .admin-page-loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.admin-page-loader__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 6rem;
  min-height: 6rem;
}

.admin-page-loader .sk-wave {
  margin: 0;
  width: 3.25rem;
  height: 2.5rem;
}

.admin-page-loader .sk-wave-rect {
  border-radius: 0.125rem;
}

.app-brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, #696cff, #33c3ff);
  color: #fff;
  box-shadow: 0 10px 24px rgba(105, 108, 255, 0.28);
}

.admin-topbar {
  /* height: auto; */
  min-height: 4.75rem;
  padding: 0.875rem 1.25rem;
  border: 1px solid rgba(105, 108, 255, 0.08);
  box-shadow: 0 14px 36px rgba(67, 71, 123, 0.08);
}

.admin-topbar__content {
  gap: 1rem;
}

.admin-topbar__intro {
  flex: 1 1 28rem;
  min-width: 0;
}

.admin-topbar__eyebrow {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.45rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(105, 108, 255, 0.12);
  color: #696cff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-topbar__title {
  margin: 0;
  font-size: clamp(1.75rem, 2vw, 2.15rem);
  line-height: 1.12;
  color: #444050;
}

.admin-topbar__subtitle {
  margin-top: 0.25rem;
  color: #6d6b77;
  font-size: 0.95rem;
  line-height: 1.45;
  max-width: 38rem;
}

.admin-topbar__actions {
  gap: 0.5rem;
  flex-shrink: 0;
}

.layout-navbar-fixed .layout-wrapper:not(.layout-without-menu) .layout-page,
.layout-navbar-fixed .layout-wrapper:not(.layout-horizontal):not(.layout-without-menu) .layout-page {
  padding-top: 8.25rem !important;
}

/* Closed control fills its form field width */
.select2-container {
  width: 100% !important;
  max-width: 100%;
}

.select2-container--default .select2-selection--single {
  min-height: 2.875rem;
  display: flex;
  align-items: center;
  border: 1px solid #d9dee3;
  border-radius: 0.375rem;
  padding: 0.4375rem 2.4rem 0.4375rem 0.875rem;
  background-color: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-left: 0;
  padding-right: 0;
  line-height: 1.5;
  color: #444050;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #a8aab4;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 0.75rem;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: #696cff;
  box-shadow: 0 0 0 0.15rem rgba(105, 108, 255, 0.16);
}

/*
 * Do NOT force width:100% on .select2-dropdown.
 * When dropdownParent is .modal (full-screen), 100% becomes the whole viewport
 * (long white/purple bars across the page). Select2 sets pixel width from the control.
 */
.select2-dropdown {
  border: 1px solid #d9dee3;
  border-radius: 0.375rem;
  overflow: hidden;
  box-shadow: 0 0.5rem 1.25rem rgba(67, 71, 123, 0.14);
  z-index: 1100;
}

.select2-container--open {
  z-index: 1100;
}

.select2-search--dropdown {
  padding: 0.75rem;
}

.select2-search--dropdown .select2-search__field {
  border: 1px solid #d9dee3;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  width: 100% !important;
  box-sizing: border-box;
}

.select2-results {
  max-height: 16rem;
}

.select2-results__option {
  padding: 0.625rem 0.875rem;
  word-break: break-word;
  white-space: normal;
}

.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: #696cff;
  color: #fff;
}

/* Bootstrap modal z-index ~1055 — keep results above dialog chrome */
.modal .select2-container--open,
.modal .select2-dropdown,
.offcanvas .select2-container--open,
.offcanvas .select2-dropdown,
.modal-open .select2-container--open,
.modal-open .select2-dropdown {
  z-index: 1105;
}

/* Allow open list to paint below the field inside filter modals */
.modal .modal-content,
.modal .modal-body {
  overflow: visible;
}

.modal .select2-container {
  z-index: 1;
}

.modal .select2-container--open {
  z-index: 1105;
}

.category-emoji {
  font-size: 1rem;
  line-height: 1;
}

.category-icon-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.category-pill {
  --category-color: #7367f0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--category-color) 12%, transparent);
  color: var(--category-color);
  font-size: 0.875rem;
  font-weight: 500;
  max-width: 100%;
  white-space: normal;
}

.category-color-preview {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.pagination-wrapper .pagination {
  margin-bottom: 0;
}

.stat-card {
  padding: 1rem;
  border-radius: 0.75rem;
  background: rgba(115, 103, 240, 0.08);
}

.stat-card span {
  display: block;
  margin-bottom: 0.25rem;
  color: #6d6b77;
  font-size: 0.8125rem;
}

.stat-card strong {
  font-size: 1.25rem;
  color: #444050;
}

.table td,
.table th {
  vertical-align: middle;
}

/* ============================================================
   Dashboard DataTables — aligned toolbars in narrow cards
   ============================================================ */

/* Kill DataTables default floats inside dashboard wrappers */
div.dataTables_wrapper:has(table.dashboard-dt) .dataTables_length,
div.dataTables_wrapper:has(table.dashboard-dt) .dataTables_filter,
div.dataTables_wrapper:has(table.dashboard-dt) .dataTables_info,
div.dataTables_wrapper:has(table.dashboard-dt) .dataTables_paginate {
  float: none !important;
  text-align: left;
  margin: 0 !important;
  padding: 0 !important;
}

/* Top bar: length (left) + search (right) on one row */
div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  width: 100%;
}

div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-toolbar .dataTables_length {
  flex: 0 0 auto;
  order: 1;
}

div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-toolbar .dataTables_filter {
  flex: 0 0 auto;
  order: 2;
  margin-left: auto !important;
  text-align: right;
}

div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-toolbar .dataTables_length label,
div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-toolbar .dataTables_filter label {
  display: flex;
  align-items: center;
  margin: 0;
  font-size: 0.8125rem;
  white-space: nowrap;
  gap: 0;
}

div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-toolbar .dataTables_length label {
  justify-content: flex-start;
}

div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-toolbar .dataTables_filter label {
  justify-content: flex-end;
}

div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-toolbar .dataTables_length select {
  display: inline-block;
  width: auto !important;
  min-width: 4.25rem;
  margin: 0 !important;
  padding: 0.35rem 1.75rem 0.35rem 0.65rem;
  font-size: 0.8125rem;
  line-height: 1.25;
  vertical-align: middle;
}

div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-toolbar .dataTables_filter input {
  display: inline-block;
  width: 8rem !important;
  max-width: 100%;
  margin: 0 0 0 0.35rem !important;
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  line-height: 1.25;
  vertical-align: middle;
}

/* Bottom bar: count (left) + pager (right) */
div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-top: 0.85rem;
  width: 100%;
}

div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-footer .dataTables_info {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  font-size: 0.8125rem;
  line-height: 2rem;
  color: #6d6b77;
}

div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-footer .dataTables_paginate {
  flex: 0 0 auto;
  margin-left: auto !important;
  text-align: right;
}

div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-footer .dataTables_paginate .pagination {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  margin: 0;
}

div.dataTables_wrapper:has(table.dashboard-dt) .dashboard-dt-footer .dataTables_paginate .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  line-height: 1;
}

/* Table headers / cells */
table.dashboard-dt thead th {
  white-space: nowrap;
  vertical-align: middle;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  padding: 0.65rem 0.75rem;
  letter-spacing: 0.01em;
}

table.dashboard-dt thead th.sorting,
table.dashboard-dt thead th.sorting_asc,
table.dashboard-dt thead th.sorting_desc {
  padding-right: 1.5rem;
}

table.dashboard-dt tbody td {
  vertical-align: middle;
  font-size: 0.875rem;
  padding: 0.65rem 0.75rem;
}

table.dashboard-dt.dataTable > thead > tr > th {
  text-align: left;
}

table.dashboard-dt.dataTable > thead > tr > th.text-center {
  text-align: center;
}

.table-responsive {
  -webkit-overflow-scrolling: touch;
}

.content-wrapper .container-xxl>.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-6,
.card-header.d-flex.justify-content-between.align-items-center,
.card-body.d-flex.justify-content-between.align-items-center.flex-wrap.gap-3,
.card-footer.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3 {
  gap: 1rem;
}

.content-wrapper .container-xxl>.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-6> :first-child,
.card-header.d-flex.justify-content-between.align-items-center> :first-child,
.card-body.d-flex.justify-content-between.align-items-center.flex-wrap.gap-3> :first-child,
.list-group-item.d-flex.justify-content-between.align-items-start.gap-3> :first-child,
.card-body>.d-flex.flex-column.gap-4>.d-flex.align-items-center.justify-content-between> :first-child {
  min-width: 0;
}

.content-wrapper .container-xxl>.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-6> :first-child {
  flex: 1 1 18rem;
}

.content-wrapper .container-xxl>.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-6>.d-flex,
.card-header.d-flex.justify-content-between.align-items-center>.d-flex,
.card-footer.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3>div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.content-wrapper .container-xxl>.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-6>.d-flex .form-control,
.content-wrapper .container-xxl>.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-6>.d-flex .select2,
.content-wrapper .container-xxl>.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-6>.d-flex .select2-container,
.card-header.d-flex.justify-content-between.align-items-center>.d-flex .form-control,
.card-header.d-flex.justify-content-between.align-items-center>.d-flex .select2,
.card-header.d-flex.justify-content-between.align-items-center>.d-flex .select2-container {
  flex: 1 1 14rem;
  min-width: 0;
}

.list-group-item.d-flex.justify-content-between.align-items-start.gap-3,
.card-body>.d-flex.flex-column.gap-4>.d-flex.align-items-center.justify-content-between {
  gap: 1rem;
}

#taskEditor .offcanvas-body {
  padding-bottom: 2rem;
}

@media (max-width: 767.98px) {

  .content-wrapper .container-xxl>.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-6,
  .card-header.d-flex.justify-content-between.align-items-center,
  .card-body.d-flex.justify-content-between.align-items-center.flex-wrap.gap-3,
  .card-footer.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3 {
    align-items: flex-start !important;
  }

  .content-wrapper .container-xxl>.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-6> :last-child,
  .card-header.d-flex.justify-content-between.align-items-center> :last-child,
  .card-body.d-flex.justify-content-between.align-items-center.flex-wrap.gap-3> :last-child,
  .card-footer.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3> :first-child,
  .card-footer.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3> :last-child,
  .pagination-wrapper {
    width: 100%;
  }

  .pagination-wrapper .pagination {
    justify-content: center;
    flex-wrap: wrap;
  }

  .content-wrapper .container-xxl>.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-6>.btn,
  .content-wrapper .container-xxl>.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3.mb-6>.d-flex .btn,
  .card-header.d-flex.justify-content-between.align-items-center>.btn,
  .card-header.d-flex.justify-content-between.align-items-center>.d-flex .btn,
  .card-footer.d-flex.flex-wrap.justify-content-between.align-items-center.gap-3 .btn {
    width: 100%;
    justify-content: center;
  }

  .table-responsive>.table {
    min-width: 0;
  }

  .table-responsive>.table thead {
    display: none;
  }

  .table-responsive>.table,
  .table-responsive>.table tbody,
  .table-responsive>.table tr,
  .table-responsive>.table td {
    display: block;
    width: 100%;
  }

  .table-responsive>.table tbody {
    display: grid;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .table-responsive>.table tr {
    overflow: hidden;
    border: 1px solid #eceef1;
    border-radius: 0.875rem;
    background-color: #fff;
  }

  .table-responsive>.table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #eceef1;
    white-space: normal;
    text-align: left;
  }

  .table-responsive>.table td:last-child {
    border-bottom: 0;
  }

  .table-responsive>.table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.35rem;
    color: #6d6b77;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .table-responsive>.table td[colspan] {
    padding: 1.25rem 1rem;
    text-align: center;
  }

  .table-responsive>.table td[colspan]::before {
    display: none;
  }

  .table-responsive>.table td[data-label='Actions'] .d-flex {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start !important;
  }

  .table-responsive>.table td[data-label='Actions'] .btn {
    flex: 1 1 5.5rem;
  }

  .list-group-item.d-flex.justify-content-between.align-items-start.gap-3,
  .card-body>.d-flex.flex-column.gap-4>.d-flex.align-items-center.justify-content-between {
    flex-direction: column;
    align-items: flex-start !important;
  }

  .list-group-item.d-flex.justify-content-between.align-items-start.gap-3 .text-end,
  .card-body>.d-flex.flex-column.gap-4>.d-flex.align-items-center.justify-content-between .text-end {
    text-align: left !important;
  }
}

/* Mobile / tablet: keep the topbar on a single row — hamburger, title, actions. */
@media (max-width: 1199.98px) {
  .admin-topbar {
    min-height: 4rem;
    padding: 0.5rem 1rem;
    flex-wrap: nowrap !important;
    align-items: center !important;
  }

  .admin-topbar .layout-menu-toggle {
    margin: 0 0.25rem 0 0 !important;
    padding: 0;
    flex: 0 0 auto;
  }

  .admin-topbar__content {
    width: auto !important;
    flex: 1 1 auto;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 0.5rem;
    min-width: 0;
  }

  .admin-topbar__intro {
    flex: 1 1 auto;
    min-width: 0;
  }

  .admin-topbar__title {
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .admin-topbar__subtitle {
    display: none;
  }

  .admin-topbar__actions {
    margin-left: auto;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    row-gap: 0;
  }

  .layout-navbar-fixed .layout-wrapper:not(.layout-without-menu) .layout-page,
  .layout-navbar-fixed .layout-wrapper:not(.layout-horizontal):not(.layout-without-menu) .layout-page {
    padding-top: 6.25rem !important;
  }
}

@media (max-width: 575.98px) {
  .admin-topbar__title {
    font-size: 1.1rem;
  }
}


/* ============================================================
   Responsive hardening — applies across every admin page
   (added for full mobile / tablet / desktop support)
   ============================================================ */

/* Unbreakable strings (emails, device IDs, store product IDs, tokens) wrap
   instead of overflowing their card/table cell — this alone prevents the
   page-level horizontal scroll without touching the layout containers. */
.text-break,
.card-body,
.list-group-item,
.table-responsive > .table td {
  overflow-wrap: anywhere;
}

.admin-synced-devices .admin-device-name {
  display: inline-block;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

@media (max-width: 767.98px) {
  .admin-synced-devices .admin-device-name {
    max-width: none;
    white-space: normal;
  }
}

/* Cards must never render with a fixed 100% height once the grid columns
   stack (< xl), otherwise a percentage height resolves against an indefinite
   parent and cards overlap. Force natural height when stacked. */
@media (max-width: 1199.98px) {
  .row > [class*='col-'] .card.h-100 {
    height: auto !important;
  }
}

/* Flex columns should be allowed to shrink so their content wraps rather
   than forcing horizontal overflow. */
.row > [class*='col-'] {
  min-width: 0;
}

/* Topbar actions wrap onto a second row rather than overflowing. */
.admin-topbar__actions {
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

/* Native date / time pickers are full width and tap-friendly on mobile. */
input[type='date'],
input[type='datetime-local'],
input[type='time'] {
  min-height: 2.6rem;
}

/* Full-width color inputs so they don't clip on narrow screens. */
.form-control-color {
  max-width: 100%;
}

/* --- Modals & offcanvas fit small screens (defensive for future use) --- */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: 0.75rem;
    max-width: calc(100% - 1.5rem);
  }

  .modal-body {
    max-height: 75vh;
    overflow-y: auto;
  }

  .offcanvas.offcanvas-end,
  .offcanvas.offcanvas-start {
    width: 100% !important;
    max-width: 22rem;
  }
}

/* --- Tighter, cleaner spacing on phones --- */
@media (max-width: 767.98px) {
  .content-wrapper .container-p-y {
    padding-top: 1.25rem !important;
    padding-bottom: 1.25rem !important;
  }

  .card-body,
  .card-header,
  .card-footer {
    padding: 1.1rem;
  }

  /* Grouped action buttons wrap instead of overflowing. */
  .btn-group,
  .card-header .d-flex.gap-2,
  .card-footer .d-flex.gap-2 {
    flex-wrap: wrap;
  }

  /* Dropdown menus stay within the viewport. */
  .dropdown-menu {
    max-width: calc(100vw - 2rem);
  }

  /* Stacked-table action buttons: comfortable tap targets. */
  .table-responsive > .table td[data-label='Actions'] .btn {
    min-height: 2.4rem;
  }

  /* Page section headings scale down a touch. */
  h4 {
    font-size: 1.35rem;
  }
}

/* --- Tablet: keep summary stat cards from crowding --- */
@media (min-width: 576px) and (max-width: 991.98px) {
  .stat-card strong {
    font-size: 1.15rem;
  }
}


/* ============================================================
   Toggle switch — force a proper pill toggle everywhere
   (fixes switches rendering as a plain round checkbox in tables)
   ============================================================ */
.form-check.form-switch {
  padding-left: 2.75em;
  min-height: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-check.form-switch .form-check-input {
  width: 2.5em;
  min-width: 2.5em;
  height: 1.4em;
  margin-top: 0;
  margin-left: -2.75em;
  flex-shrink: 0;
  border: 1px solid #d1d5db;
  border-radius: 2em;
  background-color: #e7e7eb;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
  background-position: left center;
  background-repeat: no-repeat;
  background-size: 1.1em 1.1em;
  box-shadow: none;
  transition: background-color 0.15s ease-in-out, background-position 0.15s ease-in-out, border-color 0.15s ease-in-out;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.form-check.form-switch .form-check-input:checked {
  background-color: #696cff;
  border-color: #696cff;
  background-position: right center;
}

.form-check.form-switch .form-check-input:focus {
  border-color: #696cff;
  box-shadow: 0 0 0 0.15rem rgba(105, 108, 255, 0.16);
}

.form-check.form-switch .form-check-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-check.form-switch .form-check-label {
  margin: 0;
  cursor: pointer;
}

/* ============================================================
   Ad device list — modern user-scope segmented toggle
   ============================================================ */
.ad-device-filters__field {
  min-width: 0;
}

.ad-device-filters__input {
  min-width: 10.5rem;
  border-radius: 0.75rem;
}

.ad-device-filters__actions {
  padding-bottom: 1px;
}

.scope-toggle {
  display: inline-flex;
  align-items: stretch;
  gap: 0.25rem;
  padding: 0.3rem;
  border-radius: 1rem;
  background: linear-gradient(180deg, #f6f7ff 0%, #eef0ff 100%);
  border: 1px solid rgba(105, 108, 255, 0.14);
  box-shadow:
    0 1px 2px rgba(67, 71, 123, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.scope-toggle__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.65rem;
  padding: 0.4rem 0.9rem 0.4rem 0.5rem;
  border: 0;
  border-radius: 0.8rem;
  background: transparent;
  color: #6b7280;
  font: inherit;
  line-height: 1.15;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
}

.scope-toggle__btn:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.72);
  color: #4b5563;
}

.scope-toggle__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 0.18rem rgba(105, 108, 255, 0.22);
}

.scope-toggle__btn.is-active {
  background: linear-gradient(135deg, #696cff 0%, #7b7fff 55%, #5a5fe0 100%);
  color: #fff;
  box-shadow:
    0 8px 18px rgba(105, 108, 255, 0.32),
    0 1px 0 rgba(255, 255, 255, 0.2) inset;
  transform: translateY(-1px);
}

.scope-toggle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.65rem;
  background: rgba(105, 108, 255, 0.1);
  color: #696cff;
  flex-shrink: 0;
  font-size: 1rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.scope-toggle__icon--guest {
  background: rgba(113, 121, 134, 0.12);
  color: #6b7280;
}

.scope-toggle__btn.is-active .scope-toggle__icon,
.scope-toggle__btn.is-active .scope-toggle__icon--guest {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.scope-toggle__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 0.05rem;
}

.scope-toggle__title {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.scope-toggle__hint {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.72;
  letter-spacing: 0.01em;
}

.scope-toggle__btn.is-active .scope-toggle__hint {
  opacity: 0.88;
}

@media (max-width: 575.98px) {
  .scope-toggle {
    width: 100%;
  }

  .scope-toggle__btn {
    flex: 1 1 0;
    justify-content: center;
    padding-right: 0.55rem;
  }

  .scope-toggle__text {
    align-items: center;
    text-align: center;
  }
}

/* Dashboard — Task Status Split */
.task-status-split-card {
  border-radius: 1.25rem;
}

.task-status-split-card .card-header {
  background: transparent;
}

.task-status-period {
  position: relative;
  flex: 0 0 auto;
}

.task-status-period__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0.4rem 0.85rem 0.4rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.task-status-period__btn:hover {
  border-color: #cbd5e1;
  color: #0f172a;
  background: #fff;
}

.task-status-period__btn:focus,
.task-status-period__btn:focus-visible {
  outline: none;
  border-color: #cbd5e1;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.22);
}

.task-status-period__btn .ti-calendar {
  font-size: 1rem;
  color: #64748b;
}

.task-status-period__btn .ti-chevron-down {
  font-size: 0.85rem;
  color: #94a3b8;
}

.task-status-period.is-open .task-status-period__btn .ti-chevron-down {
  transform: rotate(180deg);
}

.task-status-period__menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 20;
  min-width: 100%;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
}

.task-status-period__menu[hidden] {
  display: none;
}

.task-status-period__menu button {
  display: block;
  width: 100%;
  padding: 0.45rem 0.7rem;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: #334155;
  font-size: 0.8125rem;
  font-weight: 500;
  text-align: left;
}

.task-status-period__menu button:hover,
.task-status-period__menu button[aria-selected="true"] {
  background: #f1f5f9;
  color: #0f172a;
}

.task-status-split-card.is-loading .task-status-donut,
.task-status-split-card.is-loading .task-status-metrics {
  opacity: 0.55;
  pointer-events: none;
}

.task-status-donut {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(168px, 200px) minmax(0, 1fr);
  grid-template-areas: "completed chart pending";
  align-items: center;
  column-gap: 0.25rem;
  margin: 0.25rem 0 1.25rem;
  min-height: 228px;
}

#taskStatusChart {
  grid-area: chart;
  min-height: 220px;
}

.task-status-callout {
  position: relative;
  z-index: 1;
}

.task-status-callout--completed {
  grid-area: completed;
  text-align: right;
  padding-right: 0.35rem;
  color: #16a34a;
}

.task-status-callout--pending {
  grid-area: pending;
  text-align: left;
  padding-left: 0.35rem;
  color: #64748b;
}

.task-status-callout--progress {
  display: none;
}

.task-status-callout__pct {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.task-status-callout__name,
.task-status-callout__count {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
}

.task-status-callout__count {
  font-variant-numeric: tabular-nums;
}

.task-status-callout__line {
  display: block;
  height: 0;
  border-top: 1.5px dotted currentColor;
  opacity: 0.55;
}

.task-status-callout--completed .task-status-callout__line {
  margin: 0.35rem 0 0 auto;
  width: 42px;
}

.task-status-callout--pending .task-status-callout__line {
  margin: 0.35rem auto 0 0;
  width: 42px;
}

.task-status-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.25rem;
}

.task-status-metric {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 0.95rem;
  padding: 0.75rem 0.8rem 0.55rem;
  min-width: 0;
}

.task-status-metric--pending {
  background: #f1f5f9;
  color: #334155;
}

.task-status-metric--completed {
  background: #ecfdf5;
  color: #15803d;
}

.task-status-metric__top {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.task-status-metric__icon {
  display: inline-flex;
  width: 1.15rem;
  height: 1.15rem;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.task-status-metric__label {
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.85;
}

.task-status-metric__value {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  color: inherit;
  font-variant-numeric: tabular-nums;
}

.task-status-metric__pct {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.7;
  margin-bottom: 0.2rem;
  font-variant-numeric: tabular-nums;
}

.task-status-metric__spark {
  margin-top: 0.15rem;
  min-height: 28px;
  height: 28px;
}

.task-status-insight {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 500;
  text-align: center;
}

.task-status-insight i {
  color: #7c3aed;
  font-size: 0.95rem;
}

@media (max-width: 1399.98px) {
  .task-status-donut {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 180px) minmax(0, 1fr);
  }
}

@media (max-width: 575.98px) {
  .task-status-donut {
    grid-template-columns: 1fr;
    grid-template-areas:
      "chart"
      "completed"
      "pending";
    min-height: 0;
    row-gap: 0.75rem;
  }

  .task-status-callout--completed,
  .task-status-callout--pending,
  .task-status-callout--progress {
    text-align: center;
    padding: 0;
  }

  .task-status-callout__line {
    display: none;
  }

  .task-status-metrics {
    grid-template-columns: 1fr;
  }
}
