/* Site-wide soft neumorphic controls: inputs, switches and buttons */
:root {
  --neu-shadow: rgba(59, 42, 88, 0.16);
  --neu-shadow-soft: rgba(59, 42, 88, 0.1);
  --neu-light: rgba(255, 255, 255, 0.92);
  --neu-inset:
    inset 3px 3px 7px var(--neu-shadow-soft),
    inset -3px -3px 7px var(--neu-light);
  --neu-raised:
    4px 5px 12px var(--neu-shadow),
    -4px -4px 10px var(--neu-light);
  --neu-raised-sm:
    2px 3px 7px var(--neu-shadow-soft),
    -2px -2px 6px var(--neu-light);
}

/* Recessed input surfaces */
.catalog-search,
.bm-search,
.select-box,
.search-box,
.sw-input,
.scope-trigger,
.settings-field input,
.robot-view .field input:not([readonly]),
.robot-view .field textarea {
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: linear-gradient(145deg, #ece2f7 0%, #f9f4ff 100%);
  box-shadow:
    inset 3px 3px 7px rgba(62, 43, 92, 0.12),
    inset -3px -3px 7px rgba(255, 255, 255, 0.92),
    0 1px 0 rgba(255, 255, 255, 0.55);
}

.catalog-search:focus-within,
.bm-search:focus-within,
.select-box:focus-within,
.search-box:focus-within,
.sw-input:focus,
.scope-trigger:focus-visible,
.settings-field input:focus,
.robot-view .field input:not([readonly]):focus,
.robot-view .field textarea:focus {
  border-color: rgba(123, 99, 176, 0.48);
  background: linear-gradient(145deg, #f0e7fa 0%, #fdfbff 100%);
  box-shadow:
    inset 3px 3px 7px rgba(62, 43, 92, 0.12),
    inset -3px -3px 7px rgba(255, 255, 255, 0.94),
    0 0 0 3px rgba(158, 123, 190, 0.13);
}

.robot-view .field input[readonly] {
  border-color: rgba(255, 255, 255, 0.42);
  background: #eee5f7;
  box-shadow:
    inset 2px 2px 5px rgba(62, 43, 92, 0.1),
    inset -2px -2px 5px rgba(255, 255, 255, 0.86);
}

/* Recessed segmented tracks */
.catalog-tabs,
.bm-tabs,
.filter-tabs,
.sw-segments,
.insight-seg,
.period-switch {
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: linear-gradient(145deg, #e8ddf3 0%, #f7f0fd 100%);
  box-shadow:
    inset 3px 3px 7px rgba(62, 43, 92, 0.11),
    inset -3px -3px 7px rgba(255, 255, 255, 0.92);
}

/* Raised active chip inside each track */
.catalog-tab.is-active,
.bm-tab.is-active,
.filter-tab.is-active,
.sw-level-btn.is-active,
.insight-seg button.is-active,
.period-switch button.is-active {
  border-color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(145deg, #fefcff 0%, #efe5f8 100%);
  box-shadow:
    2px 3px 7px rgba(58, 42, 86, 0.14),
    -2px -2px 6px rgba(255, 255, 255, 0.9);
}

/* Accent actions: keep the starry gradient, add a soft raised edge */
.catalog-action,
.primary-action,
.manage-btn,
.sw-add,
.save-btn.is-dirty {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    4px 6px 14px rgba(48, 35, 79, 0.24),
    -3px -3px 9px rgba(255, 255, 255, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.catalog-action:hover,
.primary-action:hover,
.manage-btn:hover,
.sw-add:hover,
.save-btn.is-dirty:hover {
  transform: translateY(-1px);
  box-shadow:
    5px 8px 18px rgba(48, 35, 79, 0.28),
    -4px -4px 10px rgba(255, 255, 255, 0.76),
    inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

.catalog-action:active,
.primary-action:active,
.manage-btn:active,
.sw-add:active,
.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);
}

/* Neutral actions get a raised lavender surface */
.settings-save,
.settings-button:not(.danger-button),
.outline-action,
.alert-action {
  border-color: rgba(255, 255, 255, 0.7);
  background: linear-gradient(145deg, #f8f2ff 0%, #eadff5 100%);
  box-shadow:
    3px 4px 10px rgba(58, 42, 86, 0.14),
    -3px -3px 8px rgba(255, 255, 255, 0.94),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.settings-save:hover,
.settings-button:not(.danger-button):hover,
.outline-action:hover,
.alert-action:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(145deg, #fbf7ff 0%, #eee4f8 100%);
  box-shadow:
    4px 6px 13px rgba(58, 42, 86, 0.16),
    -3px -3px 8px rgba(255, 255, 255, 0.96),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.settings-save:active,
.settings-button:not(.danger-button):active,
.outline-action:active,
.alert-action:active {
  transform: translateY(1px);
  box-shadow:
    inset 2px 2px 5px rgba(58, 42, 86, 0.18),
    inset -2px -2px 5px rgba(255, 255, 255, 0.72);
}

.settings-button.danger-button {
  border-color: rgba(255, 255, 255, 0.6);
  background: linear-gradient(145deg, #fbf3f6 0%, #f1e1e8 100%);
  box-shadow:
    3px 4px 10px rgba(111, 62, 83, 0.14),
    -3px -3px 8px rgba(255, 255, 255, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.settings-button.danger-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.8);
  background: linear-gradient(145deg, #fdf7f9 0%, #f5e7ed 100%);
}

.settings-button.is-confirming,
.settings-button.danger-button.is-confirming {
  border-color: #0e1a3e;
  color: #fbf8ff;
  background: #0e1a3e;
  box-shadow:
    inset 3px 3px 8px rgba(0, 0, 0, 0.22),
    2px 3px 8px rgba(48, 35, 79, 0.2);
}

.settings-button.danger-button.is-confirming {
  border-color: #a34e75;
  background: #a34e75;
}

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

.mini-switch input:checked + .mini-switch-track,
.switch input:checked + .switch-track,
.module-switch input:checked + .switch-track,
.chat-switch input:checked + .switch-track {
  background: linear-gradient(145deg, #7b63b0 0%, #4d3b7a 100%);
  box-shadow:
    inset 2px 2px 6px rgba(31, 22, 52, 0.36),
    inset -2px -2px 6px rgba(255, 255, 255, 0.16),
    0 0 14px rgba(158, 123, 190, 0.3);
}

.mini-switch-track::after,
.switch-track::after,
.module-switch .switch-track::after,
.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 icon and row actions */
.icon-btn,
.row-delete,
.bm-delete,
.chat-delete {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: linear-gradient(145deg, #f7f0ff 0%, #ece1f7 100%);
  box-shadow:
    2px 3px 7px rgba(59, 42, 88, 0.13),
    -2px -2px 6px rgba(255, 255, 255, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, color 150ms ease;
}

.icon-btn:hover,
.row-delete:hover,
.bm-delete:hover,
.chat-delete:hover {
  background: linear-gradient(145deg, #fbf6ff 0%, #f0e7fa 100%);
  box-shadow:
    3px 4px 9px rgba(59, 42, 88, 0.15),
    -2px -2px 6px rgba(255, 255, 255, 0.94),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.icon-btn:active,
.row-delete:active,
.bm-delete:active,
.chat-delete:active {
  transform: translateY(1px) scale(0.96);
  box-shadow:
    inset 2px 2px 5px rgba(58, 42, 86, 0.18),
    inset -2px -2px 5px rgba(255, 255, 255, 0.72);
}

.workspace-pill {
  border-color: rgba(255, 255, 255, 0.75);
  background: linear-gradient(145deg, #faf5ff 0%, #ece1f7 100%);
  box-shadow:
    4px 5px 12px rgba(59, 42, 88, 0.14),
    -4px -4px 10px rgba(255, 255, 255, 0.92),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

/* Dark login page: same language, tuned for the night surface */
#login-form .field input {
  border-color: rgba(255, 255, 255, 0.16);
  background: linear-gradient(145deg, rgba(16, 27, 61, 0.72), rgba(41, 56, 99, 0.38));
  box-shadow:
    inset 3px 3px 8px rgba(3, 8, 24, 0.42),
    inset -3px -3px 8px rgba(147, 125, 192, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.08);
}

#login-form .field:focus-within input {
  border-color: rgba(208, 168, 224, 0.65);
  background: linear-gradient(145deg, rgba(20, 33, 70, 0.8), rgba(47, 63, 108, 0.44));
  box-shadow:
    inset 3px 3px 8px rgba(3, 8, 24, 0.44),
    inset -3px -3px 8px rgba(147, 125, 192, 0.12),
    0 0 0 3px rgba(158, 123, 190, 0.16);
}

#login-form .submit {
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow:
    7px 9px 22px rgba(3, 8, 28, 0.5),
    -5px -5px 16px rgba(140, 116, 190, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

#login-form .submit:hover {
  box-shadow:
    9px 12px 28px rgba(3, 8, 28, 0.56),
    -6px -6px 18px rgba(140, 116, 190, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.44);
}

#login-form .submit:active {
  box-shadow:
    inset 4px 4px 10px rgba(3, 8, 28, 0.38),
    inset -3px -3px 8px rgba(255, 255, 255, 0.12);
}

#login-form .eye {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 32, 66, 0.28);
  box-shadow:
    inset 2px 2px 5px rgba(4, 10, 28, 0.25),
    inset -2px -2px 5px rgba(255, 255, 255, 0.06);
}

#login-form .eye:hover,
#login-form .eye:focus-visible,
#login-form .eye.is-visible {
  background: rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 2px 2px 5px rgba(4, 10, 28, 0.22),
    inset -2px -2px 5px rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(208, 168, 224, 0.28);
}

#login-form .check .box {
  border-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(145deg, rgba(11, 21, 50, 0.5), rgba(48, 63, 108, 0.24));
  box-shadow:
    inset 2px 2px 5px rgba(2, 7, 20, 0.32),
    inset -2px -2px 5px rgba(255, 255, 255, 0.08);
}

#login-form .check input:checked + .box {
  border-color: rgba(208, 168, 224, 0.82);
  background: linear-gradient(145deg, #9e7bbe, #6a559d);
  box-shadow:
    inset 2px 2px 5px rgba(3, 8, 28, 0.28),
    inset -2px -2px 5px rgba(255, 255, 255, 0.18),
    0 0 12px rgba(158, 123, 190, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  .catalog-action,
  .primary-action,
  .manage-btn,
  .sw-add,
  .save-btn.is-dirty,
  .settings-save,
  .settings-button,
  .outline-action,
  .alert-action,
  .icon-btn,
  .row-delete,
  .bm-delete,
  .chat-delete {
    transition-duration: 0.01ms;
  }
}
