/*
 * ColeMo global neumorphic layer.
 * Loaded after every page stylesheet so controls share one raised/recessed language
 * without changing each page's layout or accent colors.
 */
:root {
  --neu-surface: rgba(255, 255, 255, 0.72);
  --neu-raised:
    6px 8px 18px rgba(58, 42, 86, 0.12),
    -6px -6px 15px rgba(255, 255, 255, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --neu-raised-soft:
    3px 4px 10px rgba(58, 42, 86, 0.1),
    -3px -3px 8px rgba(255, 255, 255, 0.88),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
  --neu-inset:
    inset 3px 3px 7px rgba(62, 43, 92, 0.11),
    inset -3px -3px 7px rgba(255, 255, 255, 0.93),
    0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Cards and panels: raised slab with a top light edge. */
:is(
  .stat-card,
  .catalog-stat,
  .insight-card,
  .insight-stat,
  .quick-card,
  .robot-card,
  .group-card,
  .chat-card,
  .settings-card,
  .bm-panel,
  .bm-record,
  .alert-panel,
  .alert-filter-card,
  .analytics-chart-card,
  .monitor-chart-card,
  .rank-card,
  .table-panel,
  .filter-panel,
  .info-panel,
  .coverage-panel,
  .group-picker-panel,
  .sw-form-panel,
  .sw-group-panel,
  .qa-editor,
  .catalog-panel,
  .task-card,
  .product-card,
  .qa-record,
  .sw-record
),
.stats .stat,
.admin-main .panel {
  border: 1px solid rgba(255, 255, 255, 0.74);
  background-image:
    linear-gradient(145deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0) 55%);
  box-shadow: var(--neu-raised);
}

/* Inputs and text areas: recessed wells. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]),
textarea {
  border: 1px solid rgba(255, 255, 255, 0.7);
  background:
    linear-gradient(145deg, rgba(236, 226, 247, 0.94), rgba(250, 246, 255, 0.98));
  box-shadow: var(--neu-inset);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]):focus,
textarea:focus {
  border-color: rgba(137, 105, 181, 0.55);
  background: linear-gradient(145deg, #f0e7fa, #fdfbff);
  box-shadow:
    inset 3px 3px 7px rgba(62, 43, 92, 0.11),
    inset -3px -3px 7px rgba(255, 255, 255, 0.94),
    0 0 0 3px rgba(158, 123, 190, 0.12);
}

input[readonly],
textarea[readonly] {
  color: #7f6d96;
  background: linear-gradient(145deg, #eee5f7, #f6f0fc);
  box-shadow:
    inset 2px 2px 5px rgba(62, 43, 92, 0.09),
    inset -2px -2px 5px rgba(255, 255, 255, 0.88);
}

/* Search shells keep their own inset surface; the inner input stays transparent. */
:is(.catalog-search, .bm-search, .search-box, .admin-search) input {
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* Toggle rails: recessed slot with a raised pearl. */
:is(.mini-switch-track, .switch-track, .module-switch .switch-track, .chat-switch .switch-track) {
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: linear-gradient(145deg, #e5d9f0, #faf5ff);
  box-shadow:
    inset 3px 3px 6px rgba(62, 43, 92, 0.14),
    inset -3px -3px 6px rgba(255, 255, 255, 0.95),
    0 1px 0 rgba(255, 255, 255, 0.8);
}

:is(.mini-switch-track, .switch-track, .module-switch .switch-track, .chat-switch .switch-track)::after {
  background: radial-gradient(circle at 34% 28%, #ffffff 0%, #f5ecff 56%, #e2d3f4 100%);
  box-shadow:
    2px 3px 7px rgba(56, 39, 85, 0.22),
    -2px -2px 6px rgba(255, 255, 255, 0.96),
    inset 1px 1px 2px rgba(255, 255, 255, 0.95);
}

/* Small raised controls. */
:is(
  .icon-btn,
  .menu-btn,
  .ghost-btn,
  .qa-edit,
  .qa-cancel,
  .row-delete,
  .bm-delete,
  .chat-delete,
  .group-ghost,
  .outline-action,
  .alert-action,
  .settings-button,
  .settings-save
) {
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: linear-gradient(145deg, #f9f4ff, #ece1f7);
  box-shadow: var(--neu-raised-soft);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

:is(
  .icon-btn,
  .menu-btn,
  .ghost-btn,
  .qa-edit,
  .qa-cancel,
  .row-delete,
  .bm-delete,
  .chat-delete,
  .group-ghost,
  .outline-action,
  .alert-action,
  .settings-button,
  .settings-save
):hover {
  transform: translateY(-1px);
  background: linear-gradient(145deg, #fdfaff, #f1e8fa);
  box-shadow:
    4px 6px 13px rgba(58, 42, 86, 0.14),
    -4px -4px 9px rgba(255, 255, 255, 0.94),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

:is(
  .icon-btn,
  .menu-btn,
  .ghost-btn,
  .qa-edit,
  .qa-cancel,
  .row-delete,
  .bm-delete,
  .chat-delete,
  .group-ghost,
  .outline-action,
  .alert-action,
  .settings-button,
  .settings-save
):active {
  transform: translateY(1px) scale(0.985);
  box-shadow:
    inset 2px 2px 5px rgba(58, 42, 86, 0.17),
    inset -2px -2px 5px rgba(255, 255, 255, 0.75);
}

/* Accent actions keep their gradient but get the same raised/inset physics. */
:is(
  .catalog-action,
  .primary-action,
  .manage-btn,
  .sw-add,
  .qa-save,
  .group-submit,
  .admin-primary,
  .save-btn.is-dirty
) {
  box-shadow:
    5px 7px 16px rgba(48, 35, 79, 0.22),
    -4px -4px 11px rgba(255, 255, 255, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

:is(
  .catalog-action,
  .primary-action,
  .manage-btn,
  .sw-add,
  .qa-save,
  .group-submit,
  .admin-primary,
  .save-btn.is-dirty
):hover {
  transform: translateY(-1px);
  filter: brightness(1.035);
  box-shadow:
    6px 9px 20px rgba(48, 35, 79, 0.26),
    -5px -5px 12px rgba(255, 255, 255, 0.76),
    inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

:is(
  .catalog-action,
  .primary-action,
  .manage-btn,
  .sw-add,
  .qa-save,
  .group-submit,
  .admin-primary,
  .save-btn.is-dirty
):active {
  transform: translateY(1px);
  box-shadow:
    inset 3px 3px 8px rgba(33, 23, 54, 0.3),
    inset -2px -2px 6px rgba(255, 255, 255, 0.18);
}

/* Pills, chips and status badges: tiny raised capsules instead of flat labels. */
:is(
  .admin-chip,
  .admin-badge,
  .owner-badge,
  .managed-badge,
  .env-pill,
  .monitor-pill,
  .chart-pill,
  .card-pill,
  .workspace-pill,
  .note-badge,
  .task-status,
  .task-badge,
  .sw-badge,
  .product-tag,
  .product-status,
  .record-black,
  .record-white,
  .status,
  .chat-status
) {
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow:
    2px 3px 6px rgba(58, 42, 86, 0.1),
    -2px -2px 5px rgba(255, 255, 255, 0.86),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

/* Dialog and drawer slabs. */
:is(
  .modal-card,
  .group-modal-card,
  .param-modal-card,
  .task-modal-card,
  .confirm-card,
  .drawer
) {
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow:
    16px 20px 50px rgba(32, 21, 54, 0.26),
    -8px -8px 24px rgba(255, 255, 255, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

/* Pager and segmented rails are recessed tracks. */
:is(.pager, .pager-controls, .period-switch, .catalog-tabs, .bm-tabs, .filter-tabs) {
  border: 1px solid rgba(255, 255, 255, 0.66);
  background: linear-gradient(145deg, #e9def5, #faf5ff);
  box-shadow:
    inset 3px 3px 7px rgba(62, 43, 92, 0.1),
    inset -3px -3px 7px rgba(255, 255, 255, 0.92);
}

/* Admin: flat tables and login card become part of the same surface family. */
.admin-main .admin-toolbar,
.admin-main .feature-summary,
.admin-main .group-summary,
.admin-main .user-list,
#admin-login .login-card {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background-image: linear-gradient(145deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 55%);
  box-shadow: var(--neu-raised);
}

.admin-main .table-head {
  background: linear-gradient(145deg, #eee4f8, #f9f4ff);
  box-shadow: inset 2px 2px 5px rgba(62, 43, 92, 0.08), inset -2px -2px 5px rgba(255, 255, 255, 0.9);
}

.admin-main .modal-card {
  background: #fbf7ff;
}

/* Keep colored/dark surfaces readable: shadows only, no forced light background. */
#admin-login .login-card {
  border: 1px solid rgba(255, 255, 255, 0.8);
  background-color: #fbf7ff;
  background-image: linear-gradient(145deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0) 55%);
  box-shadow:
    16px 20px 50px rgba(32, 21, 54, 0.26),
    -8px -8px 24px rgba(255, 255, 255, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

/* Page-specific wells that have higher specificity than the generic input rule. */
.qa-reply-field textarea,
.qa-trigger-field input {
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: linear-gradient(145deg, #ece2f7, #faf6ff);
  box-shadow: var(--neu-inset);
}

.qa-reply-field textarea:focus,
.qa-trigger-field input:focus {
  border-color: rgba(137, 105, 181, 0.55);
  background: linear-gradient(145deg, #f0e7fa, #fdfbff);
  box-shadow:
    inset 3px 3px 7px rgba(62, 43, 92, 0.11),
    inset -3px -3px 7px rgba(255, 255, 255, 0.94),
    0 0 0 3px rgba(158, 123, 190, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  input,
  textarea,
  button,
  :is(.icon-btn, .menu-btn, .ghost-btn, .qa-edit, .qa-cancel, .row-delete, .bm-delete, .chat-delete, .group-ghost, .outline-action, .alert-action, .settings-button, .settings-save) {
    transition-duration: 0.01ms;
  }
}

/* ============================================================
   Navigation drawer: pale lavender frosted glass
   Kept separate from the page cards so the glass stays airy.
   ============================================================ */
.drawer-backdrop {
  background:
    radial-gradient(120% 90% at 0% 42%, rgba(175, 141, 215, 0.2), rgba(175, 141, 215, 0) 68%),
    rgba(36, 24, 58, 0.2);
  -webkit-backdrop-filter: blur(5px) saturate(115%);
  backdrop-filter: blur(5px) saturate(115%);
}

.drawer {
  padding-top: 22px;
  color: #493565;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.58);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.34) 0%, rgba(252, 246, 255, 0.24) 36%, rgba(237, 222, 250, 0.16) 100%),
    radial-gradient(120% 50% at 0% 0%, rgba(216, 184, 246, 0.28), rgba(216, 184, 246, 0) 64%),
    rgba(243, 234, 252, 0.1);
  box-shadow:
    24px 0 56px rgba(57, 38, 86, 0.18),
    10px 0 24px rgba(57, 38, 86, 0.08),
    inset 1px 0 0 rgba(255, 255, 255, 0.92),
    inset -1px 0 0 rgba(112, 78, 150, 0.08);
  -webkit-backdrop-filter: blur(34px) saturate(165%);
  backdrop-filter: blur(34px) saturate(165%);
}

.drawer::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 19%),
    radial-gradient(90% 58% at 8% 0%, rgba(207, 174, 242, 0.18), rgba(207, 174, 242, 0) 66%);
  opacity: 0.7;
}

.drawer-brand-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.32);
  background: linear-gradient(180deg, rgba(255, 252, 255, 0.56), rgba(250, 244, 255, 0.24) 64%, rgba(250, 244, 255, 0) 100%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
}

.drawer-brand-mark {
  color: #68488f;
  border: 1px solid rgba(255, 255, 255, 0.92);
  background: linear-gradient(145deg, #fcf7ff, #e1cef4);
  box-shadow:
    5px 7px 16px rgba(84, 57, 120, 0.16),
    -3px -3px 9px rgba(255, 255, 255, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.drawer-brand-copy strong {
  color: #3d2a5e;
}

.drawer-brand-copy small {
  color: #806b9f;
}

.drawer .drawer-close {
  color: #775e95;
  border: 1px solid rgba(255, 255, 255, 0.82);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(229, 211, 246, 0.62));
  box-shadow:
    3px 4px 10px rgba(79, 53, 112, 0.14),
    -2px -2px 6px rgba(255, 255, 255, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.drawer .drawer-close:hover {
  color: #4c306f;
  background: linear-gradient(145deg, #ffffff, #ece0f8);
}

.drawer .drawer-close:active {
  box-shadow:
    inset 2px 2px 5px rgba(83, 54, 117, 0.14),
    inset -2px -2px 5px rgba(255, 255, 255, 0.9);
}

.drawer > .drawer-rule:first-child {
  margin-top: 0;
}

.drawer-rule {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.82), rgba(151, 113, 190, 0.24), rgba(255, 255, 255, 0.16));
}

.drawer-caption {
  color: #8d79a9;
}

.drawer-nav {
  gap: 7px;
}

.drawer-nav-item {
  min-height: 47px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 13px;
  color: #4e396b;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.5), rgba(235, 221, 249, 0.22));
  box-shadow:
    3px 4px 9px rgba(74, 48, 108, 0.08),
    -2px -3px 7px rgba(255, 255, 255, 0.56),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
  transition: color 150ms ease, background 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.drawer-nav-item svg {
  color: #9881b5;
}

@media (hover: hover) {
  .drawer-nav-item:hover {
    color: #3f285f;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(235, 221, 249, 0.3));
    box-shadow:
      4px 5px 11px rgba(74, 48, 108, 0.1),
      -2px -3px 8px rgba(255, 255, 255, 0.62),
      inset 0 1px 0 rgba(255, 255, 255, 0.82);
    transform: translateY(-1px);
  }
}

.drawer-nav-item:active {
  transform: translateY(0);
  background: linear-gradient(145deg, rgba(226, 207, 246, 0.5), rgba(250, 245, 255, 0.4));
  box-shadow:
    inset 2px 2px 5px rgba(85, 56, 119, 0.15),
    inset -2px -2px 5px rgba(255, 255, 255, 0.82);
}

.drawer-nav-item.is-active {
  color: #492a70;
  border-color: rgba(255, 255, 255, 0.34);
  background: linear-gradient(145deg, rgba(218, 194, 240, 0.56), rgba(250, 245, 255, 0.46));
  box-shadow:
    inset 3px 3px 7px rgba(82, 52, 115, 0.17),
    inset -3px -3px 7px rgba(255, 255, 255, 0.82);
  transform: none;
}

.drawer-nav-item.is-active::before {
  background: #a678d0;
  box-shadow: 0 0 12px rgba(166, 120, 208, 0.48);
}

.drawer-nav-item.is-active svg {
  color: #8754b1;
}

.drawer-logout {
  min-height: 47px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 13px;
  color: #4e396b;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.5), rgba(235, 221, 249, 0.22));
  box-shadow:
    3px 4px 9px rgba(74, 48, 108, 0.08),
    -2px -3px 7px rgba(255, 255, 255, 0.56),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
  transition: color 150ms ease, background 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.drawer-logout svg {
  color: #9881b5;
}

@media (hover: hover) {
  .drawer-logout:hover {
    color: #3f285f;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(235, 221, 249, 0.3));
    box-shadow:
      4px 5px 11px rgba(74, 48, 108, 0.1),
      -2px -3px 8px rgba(255, 255, 255, 0.62),
      inset 0 1px 0 rgba(255, 255, 255, 0.82);
    transform: translateY(-1px);
  }
}

.drawer-logout:active {
  transform: translateY(0);
  background: linear-gradient(145deg, rgba(226, 207, 246, 0.5), rgba(250, 245, 255, 0.4));
  box-shadow:
    inset 2px 2px 5px rgba(85, 56, 119, 0.15),
    inset -2px -2px 5px rgba(255, 255, 255, 0.82);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .drawer {
    background:
      linear-gradient(150deg, rgba(255, 255, 255, 0.96), rgba(244, 234, 252, 0.94)),
      #f6effc;
  }
}
