/* Case history, saved filters and actionable feedback share one compact layer. */

.toast-item {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  pointer-events: auto !important;
}
.toast-copy { flex: 1 1 auto; min-width: 0; }
.toast-action {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 11px;
  color: var(--v2-primary-purple);
  font: inherit;
  border: 1px solid rgba(124, 58, 237, .34);
  border-radius: 8px;
  background: rgba(124, 58, 237, .055);
  cursor: pointer;
}
.toast-action:hover { border-color: rgba(124, 58, 237, .64); background: rgba(124, 58, 237, .09); }
.toast-action:disabled { opacity: .55; cursor: default; }

.case-filter-popover {
  box-sizing: border-box;
  color: var(--v2-ink);
  border: 1px solid var(--ui-control-border);
  border-radius: var(--ui-frame-radius);
  background: rgba(246, 250, 254, .96);
  box-shadow: var(--v2-shadow-float);
  backdrop-filter: blur(24px) saturate(1.08);
  -webkit-backdrop-filter: blur(24px) saturate(1.08);
}
.case-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--ui-data-divider);
}
.case-tool-close {
  width: var(--ui-icon-button-size);
  height: var(--ui-icon-button-size);
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--v2-muted);
  border: 1px solid transparent;
  border-radius: var(--ui-control-radius);
  background: transparent;
  cursor: pointer;
}
.case-tool-close:hover { color: var(--v2-ink); border-color: var(--ui-control-border); }
.case-tool-close svg { width: var(--ui-icon-size); height: var(--ui-icon-size); }

.case-filter-trigger.is-active {
  color: var(--v2-primary-purple) !important;
  border-color: rgba(124, 58, 237, .38) !important;
  background: rgba(124, 58, 237, .065) !important;
}
.case-filter-popover {
  position: fixed;
  z-index: 1350;
  max-height: calc(100vh - 24px);
  opacity: 0;
  transform: translateY(-4px) scale(.99);
  transition: opacity .16s ease, transform .16s ease;
}
.case-global-filter-popover {
  width: min(440px, calc(100vw - 24px));
  padding-bottom: 10px;
  overflow-y: auto;
}
.case-filter-popover.visible { opacity: 1; transform: translateY(0) scale(1); }
.case-global-filter-popover .case-filter-header { padding: 9px 12px 5px; }
.case-filter-header > span { font-size: var(--type-caption); }
.case-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 0;
}
.case-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  padding: 8px 12px 0;
}
.case-filter-field { display: grid; gap: 5px; color: var(--v2-muted); font-size: var(--type-caption); }
.case-global-filter-popover :is(input:not([type="checkbox"]):not(.native-date-picker), select) {
  box-sizing: border-box;
  width: 100%;
  height: var(--ui-control-height) !important;
  min-height: var(--ui-control-height) !important;
  max-height: var(--ui-control-height) !important;
  padding: 0 10px;
  color: var(--v2-ink);
  font-family: inherit;
  font-size: var(--type-caption) !important;
  font-weight: 400 !important;
  border: 1px solid var(--ui-control-border);
  border-radius: var(--ui-control-radius) !important;
  outline: 0 !important;
  background: transparent;
  box-shadow: none !important;
}
.case-global-filter-popover :is(input:not([type="checkbox"]):not(.native-date-picker), select):hover { border-color: var(--ui-control-border-hover); }
.case-global-filter-popover :is(input:not([type="checkbox"]):not(.native-date-picker), select):focus {
  border-color: rgba(124, 58, 237, .48);
  outline: 0;
  box-shadow: none;
}
.case-filter-date-entry { display: grid; grid-template-columns: minmax(0, 1fr) 38px; }
.case-filter-date-entry .date-text-input { grid-column: 1 / -1; grid-row: 1; padding-right: 42px; }
.case-global-filter-popover .case-filter-date-entry .date-picker-button {
  grid-column: 2;
  grid-row: 1;
  z-index: 1;
  align-self: center;
  justify-self: center;
  width: var(--ui-icon-button-size);
  min-width: var(--ui-icon-button-size);
  max-width: var(--ui-icon-button-size);
  height: var(--ui-icon-button-size);
  min-height: var(--ui-icon-button-size);
  max-height: var(--ui-icon-button-size);
  padding: 0;
  color: var(--v2-muted);
  border: 1px solid transparent;
  border-radius: var(--ui-control-radius);
  background: transparent;
}
.case-global-filter-popover .case-filter-date-entry .date-picker-button svg { width: var(--ui-icon-size); height: var(--ui-icon-size); }
.case-filter-popover input.native-date-picker {
  position: absolute !important;
  width: 1px !important;
  min-width: 1px !important;
  max-width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  max-height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}
.case-filter-check { display: flex; align-items: center; gap: 8px; padding: 9px 12px 0; color: var(--v2-ink); }
.case-filter-check input {
  box-sizing: border-box;
  display: inline-grid;
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  place-content: center;
  padding: 0;
  appearance: none;
  color: var(--v2-primary-purple);
  border: 1px solid var(--ui-control-border);
  border-radius: 5px;
  background: transparent;
}
.case-filter-check input::before {
  content: "";
  width: 7px;
  height: 4px;
  border-bottom: 1.5px solid currentColor;
  border-left: 1.5px solid currentColor;
  opacity: 0;
  transform: translateY(-1px) rotate(-45deg);
}
.case-filter-check input:checked {
  border-color: rgba(124, 58, 237, .48);
  background: rgba(124, 58, 237, .08);
}
.case-filter-check input:checked::before { opacity: 1; }
.case-global-filter-popover .case-filter-completed {
  box-sizing: border-box;
  width: calc(100% - 24px);
  min-height: var(--ui-control-height);
  margin: 8px 12px 0;
  padding: 0 10px 0 12px;
  justify-content: space-between;
  color: var(--v2-muted);
  font-size: var(--type-caption);
  border: 1px solid var(--ui-control-border);
  border-radius: var(--ui-control-radius);
  background: transparent;
  cursor: pointer;
}
.case-global-filter-popover .case-filter-completed:hover {
  color: var(--v2-ink);
  border-color: var(--ui-control-border-hover);
}
.case-global-filter-popover .case-filter-completed input,
.case-global-filter-popover .case-filter-completed input:hover,
.case-global-filter-popover .case-filter-completed input:focus {
  position: relative;
  display: block;
  flex: 0 0 32px;
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  height: 18px !important;
  min-height: 18px !important;
  max-height: 18px !important;
  padding: 0 !important;
  color: var(--v2-primary-purple);
  border: 1px solid var(--ui-control-border) !important;
  border-radius: 999px !important;
  outline: 0 !important;
  background: transparent;
  box-shadow: none !important;
  cursor: pointer;
}
.case-global-filter-popover .case-filter-completed input::before {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  opacity: .52;
  background: currentColor;
  transform: none;
  transition: left .16s ease, opacity .16s ease;
}
.case-global-filter-popover .case-filter-completed input:checked {
  border-color: rgba(124, 58, 237, .48) !important;
  background: rgba(124, 58, 237, .08);
}
.case-global-filter-popover .case-filter-completed input:checked::before {
  left: 16px;
  opacity: 1;
}
.case-filter-actions button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--v2-ink);
  font: inherit;
  border: 1px solid var(--ui-control-border);
  border-radius: var(--ui-control-radius);
  background: transparent;
  cursor: pointer;
}
.case-filter-actions { justify-content: center; padding-top: 10px; }
.case-filter-actions .is-primary { color: var(--v2-primary-purple); border-color: rgba(124, 58, 237, .44); background: rgba(124, 58, 237, .06); }

@media (max-width: 680px) {
  .case-filter-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .case-filter-popover { transition: none !important; }
}


body.cases-visual-v2 .app-prompt-field {
  display: grid;
  gap: 7px;
  color: var(--text-muted);
  font-size: var(--type-caption);
}

body.cases-visual-v2 .app-prompt-field input {
  width: 100%;
  height: var(--control-height, 38px);
  border: 1px solid var(--line, rgba(98, 120, 150, .24));
  border-radius: var(--radius-control, 10px);
  background: transparent;
  color: var(--text-primary);
  padding: 0 12px;
  outline: 0;
}

body.cases-visual-v2 .app-prompt-field input:focus-visible {
  border-color: var(--primary, #7c3aed);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}

body.cases-visual-v2 .app-prompt-error {
  min-height: 16px;
  margin: 0;
  color: var(--danger, #dc2626);
  font-size: var(--type-caption);
}

/* Excel-style column filtering uses the header title itself: no frame, caret or decorative arrow. */

.cases-table thead .case-column-filter-trigger,
.cases-table thead .case-column-filter-trigger:hover,
.cases-table thead .case-column-filter-trigger:focus,
.cases-table thead .case-column-filter-trigger:active {
  position: relative;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 48px;
  margin: 0;
  padding: 5px 6px;
  color: inherit;
  font: inherit;
  font-size: var(--type-caption) !important;
  font-weight: 400 !important;
  line-height: 1.25;
  text-align: center;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
  cursor: pointer;
}

.cases-table thead .case-column-filter-trigger:hover,
.cases-table thead .case-column-filter-trigger:focus-visible,
.cases-table thead .case-column-filter-heading.is-filtered .case-column-filter-trigger {
  color: var(--v2-primary-purple);
}

.cases-table thead .case-column-filter-trigger:focus-visible::before {
  content: "";
  position: absolute;
  inset: 4px 7px;
  border-radius: 7px;
  background: rgba(124, 58, 237, .055);
  pointer-events: none;
}

.cases-table thead .case-column-filter-trigger > span {
  position: relative;
  z-index: 1;
}

.cases-table thead .case-column-filter-heading.is-filtered .case-column-filter-trigger::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  transform: translateX(-50%);
}

.cases-table thead .case-column-filter-trigger[aria-busy="true"] {
  opacity: .55;
  cursor: wait;
}

.case-column-filter-popover {
  width: min(320px, calc(100vw - 24px));
  padding-bottom: 10px;
  font-size: var(--type-caption) !important;
  font-weight: 400 !important;
  overflow: hidden;
}

.case-column-filter-popover .case-column-filter-header {
  padding: 11px 12px 7px;
  font-size: var(--type-caption) !important;
  font-weight: 400 !important;
  border-bottom: 0;
}

.case-column-filter-popover .case-column-filter-search {
  display: grid;
  gap: 7px;
  padding: 0 12px 8px;
}

.case-column-filter-popover .case-column-filter-search-label {
  color: var(--v2-muted);
  font-size: var(--type-caption) !important;
  font-weight: 400 !important;
  line-height: 1.25;
}

.case-column-filter-popover .case-column-filter-search input,
.case-column-filter-popover .case-column-filter-search input:hover,
.case-column-filter-popover .case-column-filter-search input:focus {
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 9px !important;
  color: var(--v2-ink);
  font-size: var(--type-caption) !important;
  font-weight: 400 !important;
  border: 1px solid var(--ui-control-border) !important;
  border-radius: var(--ui-control-radius) !important;
  outline: 0 !important;
  background: transparent;
  box-shadow: none !important;
}

.case-column-filter-popover .case-column-filter-search input:hover {
  border-color: var(--ui-control-border-hover);
}

.case-column-filter-popover .case-column-filter-search input:focus {
  border-color: rgba(124, 58, 237, .48) !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.case-column-filter-popover .case-column-filter-all,
.case-column-filter-popover .case-column-filter-value {
  box-sizing: border-box;
  width: 100%;
  min-height: 32px;
  margin: 0;
  padding: 6px 13px;
  font-size: var(--type-caption) !important;
  font-weight: 400 !important;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.case-column-filter-popover .case-column-filter-all {
  margin: 0 6px 2px;
  width: calc(100% - 12px);
  color: var(--v2-primary-purple);
}

.case-date-filter-group[hidden],
.case-column-filter-value[hidden] {
  display: none !important;
}

.case-date-filter-group-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  min-height: 32px;
  border-radius: 8px;
}

.case-date-filter-group-row:hover,
.case-date-filter-group-row:focus-within {
  background: rgba(124, 58, 237, .045);
}

.case-date-filter-toggle,
.case-date-filter-toggle:hover,
.case-date-filter-toggle:focus {
  display: grid;
  width: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  max-height: 16px !important;
  padding: 0;
  place-items: center;
  justify-self: center;
  color: var(--v2-muted);
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}

html body.cases-visual-v2 .case-column-filter-popover .case-date-filter-toggle svg {
  width: 12px !important;
  min-width: 12px !important;
  max-width: 12px !important;
  height: 12px !important;
  min-height: 12px !important;
  max-height: 12px !important;
}

.case-column-filter-popover .case-date-filter-group-select {
  min-height: 32px;
  margin: 0;
  padding: 5px 8px 5px 0;
  gap: 8px;
  color: var(--v2-ink);
  font-size: var(--type-caption) !important;
  cursor: pointer;
}

.case-column-filter-popover .case-date-filter-month > .case-date-filter-group-row .case-date-filter-group-select {
  color: var(--v2-muted);
}

.case-date-filter-group-select small {
  margin-left: auto;
  color: var(--v2-muted);
  font-size: var(--type-micro);
  font-weight: 400;
}

.case-date-filter-group > .case-date-filter-group-children {
  margin-left: 12px;
  padding-left: 10px;
  border-left: 1px solid rgba(124, 58, 237, .13);
}

.case-date-filter-month > .case-date-filter-group-children {
  margin-left: 12px;
  padding-left: 8px;
}

.case-date-filter-group.is-collapsed > .case-date-filter-group-children {
  display: none;
}

.case-column-filter-popover.is-searching .case-date-filter-group > .case-date-filter-group-children {
  display: block;
}

.case-column-filter-popover .case-date-filter-value {
  padding-left: 9px;
}

.case-column-filter-popover .case-date-filter-ungrouped {
  margin-top: 2px;
}

.case-column-filter-popover .case-column-filter-value:hover,
.case-column-filter-popover .case-column-filter-value:focus-within {
  background: rgba(124, 58, 237, .055);
}

.case-column-filter-popover .case-filter-check input,
.case-column-filter-popover .case-filter-check input:hover,
.case-column-filter-popover .case-filter-check input:focus {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  color: var(--v2-primary-purple);
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}

.case-column-filter-popover .case-filter-check input:checked {
  border: 0;
  background: transparent;
}

.case-column-filter-popover .case-filter-check input::before {
  width: 8px;
  height: 5px;
  border-width: 0 0 1.5px 1.5px;
}

.case-column-filter-values {
  box-sizing: border-box;
  max-height: min(310px, calc(100vh - 230px));
  margin: 0 6px;
  padding: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(113, 131, 151, .35) transparent;
}

.case-column-filter-value > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-column-filter-empty {
  margin: 14px 12px;
  color: var(--v2-muted);
  font-size: var(--type-caption);
  text-align: center;
}

.case-column-filter-popover .case-column-filter-actions {
  gap: 16px;
  padding: 9px 12px 0;
}

.case-column-filter-popover .case-column-filter-actions button,
.case-column-filter-popover .case-column-filter-actions button:hover,
.case-column-filter-popover .case-column-filter-actions button:focus {
  min-height: 30px;
  padding: 0 6px;
  color: var(--v2-muted);
  font-size: var(--type-caption) !important;
  font-weight: 400 !important;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}

.case-column-filter-popover .case-column-filter-actions .is-primary,
.case-column-filter-popover .case-column-filter-actions .is-primary:hover,
.case-column-filter-popover .case-column-filter-actions .is-primary:focus {
  color: var(--v2-primary-purple);
  border: 0;
  background: transparent;
}

.case-column-filter-popover .case-column-filter-actions button:disabled {
  opacity: .35;
  cursor: default;
}
