:root {
  --bg: #0d141d;
  --bg2: #121b26;
  --bg3: #18232f;
  --raise: #1d2937;
  --line: #26313f;
  --line2: #33414f;
  --txt: #e6edf3;
  --txt2: #9aa7b5;
  --txt3: #697684;
  --teal: #22c6b8;
  --teal-dim: rgba(34, 198, 184, .13);
  --teal-line: rgba(34, 198, 184, .4);
  --table-row-hover: #18232f;
  --table-row-selected: #18232f;
  --table-row-selected-line: var(--teal);
  --amber: #f2a93b;
  --red: #ef5a5a;
  --green: #35c46a;
  --blue: #4d9be6;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

/* `display: block/flex` đặt trên .fld/.btn/... (specificity ngang UA default
   `[hidden]{display:none}`) sẽ thắng vì là author stylesheet — khiến thuộc
   tính `hidden` bị vô hiệu hoá âm thầm trên các phần tử đó (vd: JS set
   `.hidden = true` cho 1 <label class="fld" hidden> vẫn hiện nguyên, xem
   schedules.js). Ép `[hidden]` luôn thắng để dùng thuộc tính hidden ở đâu
   cũng chắc ăn, khỏi phải nhớ né class nào. */
[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[x-cloak] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

form {
  margin: 0;
}

.mono {
  font-family: var(--mono);
}

.spacer {
  flex: 1;
}

.ok {
  color: var(--green);
}

.danger {
  color: var(--red);
}

.warn-text {
  color: var(--amber);
}

.text-center {
  text-align: center;
}

.btn {
  min-height: 36px;
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border: 1px solid rgba(77, 155, 230, .42);
  border-radius: 8px;
  background: rgba(77, 155, 230, .1);
  color: #8bc4ff;
  cursor: pointer;
  font: inherit;
  font-size: 12.8px;
  font-weight: 600;
  text-decoration: none;
  transition: background .12s, border-color .12s;
}

.btn:hover {
  background: rgba(77, 155, 230, .16);
  border-color: rgba(139, 196, 255, .7);
}

.btn.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #06231f;
}

.btn.primary:hover,
.btn.primary:focus {
  background: #2ad6c7;
}

.btn.ghost {
  background: transparent;
  border-color: var(--line2);
  color: var(--txt);
}

.btn.ghost:hover {
  background: var(--raise);
  border-color: #4a5a6a;
}

.btn.sm {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 11.8px;
}

.btn.danger {
  color: var(--red);
  border-color: rgba(239, 90, 90, .35);
  background: rgba(239, 90, 90, .1);
}

.btn.danger:hover {
  border-color: rgba(239, 90, 90, .65);
  background: rgba(239, 90, 90, .16);
}

.btn.success {
  border-color: rgba(53, 196, 106, .45);
  background: rgba(53, 196, 106, .1);
  color: #7ce29f;
}

.btn.success:hover {
  border-color: rgba(124, 226, 159, .7);
  background: rgba(53, 196, 106, .16);
}

.btn.warning {
  border-color: rgba(242, 169, 59, .45);
  background: rgba(242, 169, 59, .1);
  color: #f0cf98;
}

.btn.warning:hover {
  border-color: rgba(240, 207, 152, .7);
  background: rgba(242, 169, 59, .16);
}

.btn:disabled,
.btn[disabled] {
  border-color: var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--txt3);
  cursor: not-allowed;
  opacity: .75;
}

.sel,
.inp {
  height: 36px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--bg2);
  color: var(--txt);
  font: inherit;
  font-size: 12.8px;
  transition: border-color .12s, background .12s;
}

.sel:focus,
.inp:focus {
  border-color: var(--teal-line);
  background: var(--bg3);
}

.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
  min-height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--txt);
  box-shadow: none;
  font: inherit;
  font-size: 12.8px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

/* .single cố định 1 dòng (chỉ 1 giá trị hiển thị). .multi (nhiều chip) cần
   cao tự do — xem quy tắc riêng ".ts-wrapper.multi .ts-control" phía dưới,
   ghi đè height/padding ở đây. */
.ts-wrapper.single .ts-control {
  height: 34px;
  padding: 7px 34px 7px 11px;
}

.ts-wrapper.sel {
  height: 36px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg2);
}

.filters-enhanced .floating-filter .ts-wrapper.sel {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.filters > .btn {
  height: 36px;
  min-height: 36px;
  line-height: 20px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.ts-control,
.ts-wrapper.single.input-active .ts-control,
.ts-wrapper.single.dropdown-active .ts-control {
  background: transparent;
  color: var(--txt);
}

.ts-wrapper.focus .ts-control,
.ts-wrapper.single.input-active.focus .ts-control {
  border-color: var(--teal-line);
  background: transparent;
  color: var(--txt);
}

.ts-wrapper.single .ts-control::after {
  right: 12px;
  border-color: var(--txt2) transparent transparent;
}

.ts-wrapper.single.dropdown-active .ts-control::after {
  border-color: transparent transparent var(--txt2);
}

.ts-wrapper .ts-control > input {
  background: transparent;
  color: var(--txt);
  font: inherit;
}

.ts-wrapper .ts-control > input::placeholder {
  color: var(--txt3);
  opacity: 1;
}

.ts-wrapper .item {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  color: var(--txt);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chọn nhiều (Chi nhánh sau khi lọc theo Khu vực, v.v.) — control phải cao
   tự do theo số chip đã chọn thay vì cố định 34px như .single (nếu không,
   chip xuống dòng thứ 2 sẽ bị đè/che lên nội dung khác thay vì đẩy khung cao
   ra). Item hiện thành pill nhỏ gọn kèm nút "×" riêng (plugin remove_button,
   xem select_enhancer.js) thay vì bấm-rồi-Backspace mặc định — không rõ ràng,
   dễ xoá nhầm chip khác. */
.ts-wrapper.multi .ts-control {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  height: auto;
  min-height: 34px;
  max-height: 96px;
  overflow-y: auto;
  padding: 5px 34px 5px 11px;
}

/* Selector khớp đúng cấu trúc TomSelect render chip ("> div.item") để chắc
   chắn thắng specificity rule mặc định của thư viện
   (.ts-wrapper.multi .ts-control > div trong tom-select.css) — nếu không,
   nền/màu chữ mỗi chip có thể lẫn theo màu build-in của thư viện thay vì
   theme của app (bug đã gặp: chip hiện màu loang lổ khác nhau từng cái). */
.ts-wrapper.multi .ts-control > div.item {
  flex: 0 1 auto;
  gap: 4px;
  max-width: 100%;
  padding: 2px 4px 2px 9px;
  border-radius: 999px;
  /* Nền/độ đậm giống .badge (global.css ~L462) — nền phẳng var(--raise) quá
     gần màu nền của .floating-filter khi focus (var(--bg3)) nên chip nhìn mờ,
     khó phân biệt viền (bug đã gặp: "mờ mờ" trong ảnh chụp màn hình). */
  background: rgba(34, 198, 184, .13);
  color: var(--teal);
  font-weight: 600;
  font-size: 11.5px;
  line-height: 1.5;
}

.ts-wrapper.multi .item .remove {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-left: 0;
  border-radius: 50%;
  color: var(--txt3);
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
}

.ts-wrapper.multi .item .remove:hover {
  color: #9E9E9E;
}
.ts-wrapper.plugin-remove_button:not(.rtl) .item .remove {
    border-left: none!important;
    margin-left: 0px!important;
}
.ts-dropdown {
  z-index: 120;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--txt);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .34);
  overflow: hidden;
}

.ts-dropdown .dropdown-input {
  width: calc(100% - 16px);
  margin: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--txt);
  font: inherit;
  font-size: 12.8px;
}

.ts-dropdown .option,
.ts-dropdown .no-results {
  padding: 9px 11px;
  color: var(--txt2);
}

.ts-dropdown .active {
  background: var(--teal-dim);
  color: var(--teal);
}

.ts-dropdown .selected {
  color: var(--txt);
  font-weight: 700;
}

.camera-ai-date-range-picker {
  display: grid !important;
  grid-template-columns: 148px 268px;
  align-items: stretch;
  width: 416px !important;
  max-width: none !important;
  box-sizing: border-box;
}

.camera-ai-date-range-picker .camera-ai-date-presets {
  grid-column: 1;
  grid-row: 1 / -1;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 8px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .02);
}

.camera-ai-date-range-picker > :not(.camera-ai-date-presets):not(.air-datepicker--pointer),
.camera-ai-date-range-picker .air-datepicker-nav,
.camera-ai-date-range-picker .air-datepicker--content,
.camera-ai-date-range-picker .air-datepicker--buttons {
  grid-column: 2;
  min-width: 0;
}

.camera-ai-date-range-picker .air-datepicker--content {
  width: 268px;
  box-sizing: border-box;
}

.camera-ai-date-presets button {
  width: 100%;
  min-height: 26px;
  padding: 4px 8px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, .04);
  color: var(--teal);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

.camera-ai-date-presets button:hover,
.camera-ai-date-presets button:focus-visible {
  background: var(--teal-dim);
  color: #c8fff8;
  outline: none;
}

.fld {
  display: block;
}

.lb {
  display: block;
  margin-bottom: 6px;
  color: var(--txt2);
  font-size: 11.5px;
  font-weight: 600;
}

.eyebrow {
  color: var(--txt3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  padding: 2.5px 8px;
  border-radius: 20px;
  background: #232f3d;
  color: var(--txt2);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  max-width: 100%;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(242, 169, 59, .13);
  color: #f0bd6e;
  font-family: var(--ui);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.status-pill.b-green,
.status-pill.status-active,
.status-pill.active,
.status-pill.success,
.status-pill.resolved,
.status-pill.reviewed,
.status-pill.ready,
.status-pill.saved,
.status-pill[data-status="active"],
.status-pill[data-status="success"],
.status-pill[data-status="resolved"],
.status-pill[data-status="reviewed"],
.status-pill[data-status="ready"],
.status-pill[data-status="saved"] {
  background: rgba(34, 198, 184, .14);
  color: var(--teal);
}

.status-pill.b-red,
.status-pill.status-error,
.status-pill.failed,
.status-pill.error,
.status-pill.false_positive,
.status-pill.revoked,
.status-pill.canceled,
.status-pill.cancel,
.status-pill[data-status="failed"],
.status-pill[data-status="error"],
.status-pill[data-status="false_positive"],
.status-pill[data-status="revoked"],
.status-pill[data-status="canceled"],
.status-pill[data-status="cancel"] {
  background: rgba(239, 90, 90, .14);
  color: #ff7d7d;
}

.status-pill.b-gray,
.status-pill.inactive,
.status-pill.idle,
.status-pill.pending,
.status-pill[data-status="inactive"],
.status-pill[data-status="idle"],
.status-pill[data-status="pending"] {
  background: rgba(105, 118, 132, .16);
  color: #aeb9c5;
}

.status-pill.b-teal,
.status-pill.running,
.status-pill.processing,
.status-pill.scanning,
.status-pill.saving,
.status-pill[data-status="running"],
.status-pill[data-status="processing"],
.status-pill[data-status="scanning"],
.status-pill[data-status="saving"] {
  background: rgba(77, 155, 230, .16);
  color: #8bc4ff;
}

.b-green,
.status-active {
  background: rgba(34, 198, 184, .14);
  color: var(--teal);
}

.b-amber,
.status-inactive {
  background: rgba(242, 169, 59, .13);
  color: #f0bd6e;
}

.b-red,
.status-error {
  background: rgba(239, 90, 90, .14);
  color: #ff7d7d;
}

.b-blue {
  background: rgba(77, 155, 230, .16);
  color: #8bc4ff;
}

.b-gray {
  background: rgba(105, 118, 132, .16);
  color: #aeb9c5;
}

.b-teal {
  background: rgba(34, 198, 184, .14);
  color: var(--teal);
}

.b-violet {
  background: rgba(139, 92, 246, .16);
  color: #c4b5fd;
}

.page-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 42%, rgba(34, 198, 184, .12), transparent 34%),
    rgba(5, 11, 17, .54);
  backdrop-filter: blur(5px) saturate(1.08);
  opacity: 0;
  cursor: progress;
  transition: opacity 160ms ease;
}

.page-loading-overlay[hidden] {
  display: none;
}

.page-loading-overlay.is-active {
  opacity: 1;
}

.page-loading-indicator {
  position: relative;
  isolation: isolate;
  min-width: min(320px, calc(100vw - 48px));
  min-height: 96px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px 28px 20px;
  border: 1px solid rgba(139, 196, 255, .18);
  border-radius: 14px;
  /* background:
    linear-gradient(180deg, rgba(24, 35, 47, .92), rgba(13, 20, 29, .94)); */
  color: var(--txt);
  box-shadow: 0 0px 0px rgba(0, 0, 0, .46), inset 0 1px 0 rgba(255, 255, 255, .05);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: .01em;
  overflow: hidden;
  transform: translateY(6px) scale(.98);
  transition: transform 180ms cubic-bezier(.22, 1, .36, 1);
}

.page-loading-overlay.is-active .page-loading-indicator {
  transform: translateY(0) scale(1);
}

.page-loading-spinner {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}

.page-loading-spinner::before,
.page-loading-spinner::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.page-loading-spinner::before {
  inset: 0;
  border: 2px solid rgba(139, 196, 255, .16);
  border-top-color: var(--teal);
  border-right-color: rgba(34, 198, 184, .55);
  box-shadow: 0 0 26px rgba(34, 198, 184, .22);
  animation: page-loading-spin .72s linear infinite;
}

.page-loading-spinner::after {
  inset: 7px;
  border: 2px solid transparent;
  border-left-color: rgba(139, 196, 255, .74);
  border-bottom-color: rgba(139, 196, 255, .28);
  animation: page-loading-spin 1.05s linear infinite reverse;
}

.page-loading-indicator::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--teal), #8bc4ff, transparent);
  transform: translateX(-100%);
  animation: page-loading-bar 1.35s ease-in-out infinite;
}

@keyframes page-loading-spin {
  to { transform: rotate(360deg); }
}

@keyframes page-loading-bar {
  0% { transform: translateX(-100%); }
  55%, 100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .page-loading-overlay,
  .page-loading-indicator { transition: none; }
  .page-loading-spinner,
  .page-loading-spinner::after,
  .page-loading-indicator::after { animation-duration: 1.8s; }
}


.txt-uppercase {
  text-transform: uppercase;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
}

.page-size-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 5px;
}

.page-size-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.page-size-control .t-id {
  flex: 0 0 auto;
  white-space: nowrap;
}

.page-count {
  color: var(--txt2);
  font-family: var(--mono);
  font-size: 12px;
}

.btn.disabled {
  opacity: .45;
  pointer-events: none;
}

.pagination .btn.active {
  border-color: var(--teal-line);
  background: var(--teal-dim);
  color: var(--teal);
  pointer-events: none;
}

/* Shared AirDatepicker skin. */
.air-datepicker {
  --adp-background-color: #151f2a;
  --adp-background-color-hover: rgba(77, 155, 230, .16);
  --adp-background-color-active: rgba(77, 155, 230, .22);
  --adp-color: var(--txt);
  --adp-color-secondary: var(--txt3);
  --adp-accent-color: var(--teal);
  --adp-cell-background-color-selected: rgba(77, 155, 230, .22);
  --adp-cell-background-color-selected-hover: rgba(77, 155, 230, .3);
  --adp-cell-border-radius: 999px;
  --adp-border-color: var(--line);
  --adp-border-color-inner: var(--line);
  --adp-day-name-color: var(--teal);
  --adp-nav-arrow-color: var(--txt2);
  z-index: 9999;
  border-radius: 10px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .35);
}

.air-datepicker-button {
  color: var(--teal);
}
.access-denied {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--bg);
  color: var(--txt);
  text-align: center;
}
.access-denied > i { font-size: 34px; color: var(--red); }
.access-denied h1, .access-denied p { margin: 0; }
.access-denied p { color: var(--txt3); }
