/* PulseBot v21.8.8 — final refinement for premium accents and system modules.
   Visual-only layer: endpoints, fields and module behavior stay unchanged. */

body#pulsebot-app.dashboard-mode {
  --pb2188-blue: #367de8;
  --pb2188-blue-hover: #4388f0;
  --pb2188-blue-pressed: #2d69c6;
  --pb2188-blue-soft: rgba(54,125,232,.075);
  --pb2188-blue-line: rgba(72,143,246,.27);
  --pb2188-line: rgba(255,255,255,.072);
  --pb2188-line-strong: rgba(255,255,255,.125);
  --pb2188-surface: #0b0f15;
  --pb2188-surface-2: #0e131a;
  --pb2188-text: #edf2f8;
  --pb2188-text-2: #c7ced8;
  --pb2188-muted: #8993a1;
  --pb2188-soft: #65707e;
}

/* One button language across every dashboard module — no purple hover. */
body#pulsebot-app.dashboard-mode .btn-primary:not(.danger) {
  border: 1px solid rgba(130,179,255,.30) !important;
  background: var(--pb2188-blue) !important;
  background-image: none !important;
  color: #fff !important;
  box-shadow: none !important;
  text-shadow: none !important;
  transform: none !important;
}

body#pulsebot-app.dashboard-mode .btn-primary:not(.danger):hover,
body#pulsebot-app.dashboard-mode .btn-primary:not(.danger):focus-visible {
  border-color: rgba(164,201,255,.42) !important;
  background: var(--pb2188-blue-hover) !important;
  background-image: none !important;
  color: #fff !important;
  box-shadow: none !important;
  transform: none !important;
}

body#pulsebot-app.dashboard-mode .btn-primary:not(.danger):active {
  background: var(--pb2188-blue-pressed) !important;
}

body#pulsebot-app.dashboard-mode .btn-ghost:hover,
body#pulsebot-app.dashboard-mode .btn-ghost:focus-visible {
  border-color: rgba(255,255,255,.17) !important;
  background: rgba(255,255,255,.035) !important;
  color: var(--pb2188-text) !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Remove old purple Premium treatment in module headers and feature blocks. */
body#pulsebot-app.dashboard-mode .server-top.is-premium {
  border: 0 !important;
  border-bottom: 1px solid var(--pb2188-line) !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

body#pulsebot-app.dashboard-mode .server-top.is-premium::before,
body#pulsebot-app.dashboard-mode .server-top.is-premium::after {
  content: none !important;
  display: none !important;
}

body#pulsebot-app.dashboard-mode :is(.server-premium-badge,.side-premium-badge,.guild-premium-badge,.premium-inline-badge) {
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0 !important;
  margin: 0 0 0 8px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-image: none !important;
  color: #78aaff !important;
  font-size: .65rem !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  letter-spacing: .09em !important;
  text-transform: uppercase !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

body#pulsebot-app.dashboard-mode :is(
  .premium-lock-card,
  .premium-locked-section,
  .plan-limit-note,
  .automod-escalation-section,
  .ticket-panels-section,
  .ticket-questions-section,
  .premium-workflow-grid > *,
  .plan-limit-note.is-premium
) {
  box-shadow: none !important;
  background-image: none !important;
}

body#pulsebot-app.dashboard-mode :is(
  .premium-lock-card,
  .premium-locked-section,
  .plan-limit-note,
  .automod-escalation-section,
  .ticket-panels-section,
  .ticket-questions-section,
  .premium-workflow-grid > *
):hover {
  border-color: var(--pb2188-line-strong) !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  transform: none !important;
}

/* New compact plan limit presentation. */
body#pulsebot-app.dashboard-mode .plan-limit-note {
  display: block !important;
  margin: 10px 0 24px !important;
  padding: 17px 2px !important;
  border: 0 !important;
  border-top: 1px solid var(--pb2188-line) !important;
  border-bottom: 1px solid var(--pb2188-line) !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--pb2188-text-2) !important;
}

body#pulsebot-app.dashboard-mode .plan-limit-note > span {
  display: none !important;
}

body#pulsebot-app.dashboard-mode .plan-limit-copy {
  min-width: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 22px !important;
}

body#pulsebot-app.dashboard-mode .plan-limit-copy > strong {
  color: var(--pb2188-text) !important;
  font-size: .82rem !important;
  font-weight: 600 !important;
  letter-spacing: -.01em !important;
}

body#pulsebot-app.dashboard-mode .plan-limit-values {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 20px !important;
  flex-wrap: wrap !important;
}

body#pulsebot-app.dashboard-mode .plan-limit-values > span {
  display: inline-flex !important;
  align-items: baseline !important;
  gap: 7px !important;
  color: var(--pb2188-soft) !important;
  font-size: .68rem !important;
  font-weight: 500 !important;
  line-height: 1.3 !important;
  letter-spacing: .045em !important;
  text-transform: uppercase !important;
}

body#pulsebot-app.dashboard-mode .plan-limit-values b {
  color: #7eaeff !important;
  font-size: .82rem !important;
  font-weight: 650 !important;
  font-variant-numeric: tabular-nums !important;
  letter-spacing: 0 !important;
}

/* Shared cleanup for Tickets, Messages and Statistics. */
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-form {
  gap: 0 !important;
  padding-bottom: 104px !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-form > .form-section,
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-form > .module-panel-special {
  padding: 34px 2px 38px !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-form > .form-section:first-child,
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-form > .module-panel-special:first-child {
  padding-top: 26px !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .form-section-head {
  margin-bottom: 23px !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .form-section-head.messages-section-head {
  display: grid !important;
  grid-template-columns: minmax(0,1fr) auto !important;
  align-items: start !important;
  gap: 26px !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .form-section-head.messages-section-head > .btn {
  align-self: start !important;
  margin-top: 2px !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .field {
  margin: 16px 0 !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-grid {
  gap: 18px 22px !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .action-row {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  margin: 20px 0 4px !important;
  flex-wrap: wrap !important;
}

/* All enabled states are blue, never green. */
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-status.on {
  border-color: transparent !important;
  background: transparent !important;
  color: #82b0fb !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-status.on::before {
  background: var(--pb2188-blue) !important;
  box-shadow: none !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .switch-control:has(input:checked) .switch-state {
  color: #82b0fb !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .toggle input:checked + .toggle-track,
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .toggle input:checked + span {
  border-color: var(--pb2188-blue) !important;
  background: var(--pb2188-blue) !important;
  background-image: none !important;
  box-shadow: none !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .toggle input:focus-visible + .toggle-track,
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .toggle input:focus-visible + span {
  outline: 2px solid rgba(54,125,232,.44) !important;
  outline-offset: 3px !important;
}

/* Checkboxes and pickers — force compact blue state over old purple rules. */
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .check:has(> input[type="checkbox"]:checked),
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .check.is-checked {
  border-color: rgba(54,125,232,.24) !important;
  background: rgba(54,125,232,.045) !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .check > input[type="checkbox"]:checked + .check-box,
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .check.is-checked > .check-box {
  border-color: var(--pb2188-blue) !important;
  background: var(--pb2188-blue) !important;
  box-shadow: none !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .multi-picker-option.selected,
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .multi-picker-option:has(> input[type="checkbox"]:checked) {
  border-color: var(--pb2188-blue-line) !important;
  background: var(--pb2188-blue-soft) !important;
  box-shadow: none !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .multi-picker-option > input[type="checkbox"]:checked {
  border-color: var(--pb2188-blue) !important;
  background-color: var(--pb2188-blue) !important;
  box-shadow: none !important;
}

/* One identical fixed save control for all three modules. */
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-form > .module-savebar {
  position: fixed !important;
  inset: auto 24px 24px auto !important;
  z-index: 980 !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-form > .module-savebar > .notice {
  display: none !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-save-button {
  min-width: 190px !important;
  min-height: 46px !important;
  padding: 0 20px !important;
  border: 1px solid rgba(130,179,255,.31) !important;
  border-radius: 9px !important;
  background: var(--pb2188-blue) !important;
  background-image: none !important;
  color: #fff !important;
  font-size: .85rem !important;
  font-weight: 600 !important;
  letter-spacing: -.004em !important;
  box-shadow: 0 12px 28px rgba(0,0,0,.28) !important;
  transform: none !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-save-button::before,
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-save-button::after {
  content: none !important;
  display: none !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-save-button:hover:not(:disabled),
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-save-button:focus-visible:not(:disabled) {
  border-color: rgba(164,201,255,.43) !important;
  background: var(--pb2188-blue-hover) !important;
  box-shadow: 0 12px 28px rgba(0,0,0,.28) !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-save-button.saved {
  border-color: rgba(130,179,255,.31) !important;
  background: var(--pb2188-blue) !important;
}

/* Simple save notification placed above the fixed button. */
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .toast {
  right: 24px !important;
  bottom: 82px !important;
  width: min(340px, calc(100vw - 32px)) !important;
  min-height: 44px !important;
  gap: 0 !important;
  padding: 11px 13px !important;
  border: 1px solid var(--pb2188-line-strong) !important;
  border-radius: 8px !important;
  background: #0e131a !important;
  color: var(--pb2188-text-2) !important;
  box-shadow: 0 14px 34px rgba(0,0,0,.32) !important;
}

body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .toast::before,
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .toast::after,
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .toast-message::before,
body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .toast-message::after {
  content: none !important;
  display: none !important;
}

/* Tickets — more breathing room and quieter premium workflow. */
body#pulsebot-app.dashboard-active-tickets .module-form-tickets > .form-section:first-of-type .form-section-body {
  gap: 4px 26px !important;
}

body#pulsebot-app.dashboard-active-tickets .variable-help {
  margin-top: 22px !important;
  padding-top: 20px !important;
}

body#pulsebot-app.dashboard-active-tickets .variable-grid {
  grid-template-columns: repeat(3, minmax(0,1fr)) !important;
  gap: 11px !important;
  margin-top: 13px !important;
}

body#pulsebot-app.dashboard-active-tickets .variable-chip {
  min-height: 48px !important;
  padding: 10px 12px !important;
}

body#pulsebot-app.dashboard-active-tickets :is(.ticket-panels-section,.ticket-questions-section,.premium-locked-section) {
  padding-top: 36px !important;
  padding-bottom: 38px !important;
}

body#pulsebot-app.dashboard-active-tickets .premium-workflow-grid {
  gap: 16px !important;
  margin-top: 20px !important;
}

body#pulsebot-app.dashboard-active-tickets .ticket-panel-card,
body#pulsebot-app.dashboard-active-tickets .ticket-question-card {
  min-height: 72px !important;
  padding-top: 17px !important;
  padding-bottom: 17px !important;
}

body#pulsebot-app.dashboard-active-tickets .ticket-panel-card-actions,
body#pulsebot-app.dashboard-active-tickets .message-rule-actions {
  display: flex !important;
  gap: 9px !important;
}

body#pulsebot-app.dashboard-active-tickets .module-form-tickets > p {
  margin: 24px 0 8px !important;
}

/* Automated messages — quieter limit summary and larger spacing. */
body#pulsebot-app.dashboard-active-messages .messages-section {
  padding-top: 36px !important;
  padding-bottom: 38px !important;
}

body#pulsebot-app.dashboard-active-messages .message-rule-list {
  margin-top: 8px !important;
}

body#pulsebot-app.dashboard-active-messages .message-rule-card {
  min-height: 74px !important;
  padding: 17px 2px !important;
}

body#pulsebot-app.dashboard-active-messages .message-rule-actions {
  display: flex !important;
  gap: 9px !important;
}

body#pulsebot-app.dashboard-active-messages .empty-rules {
  margin-top: 14px !important;
  padding: 18px !important;
}

body#pulsebot-app.dashboard-active-messages .counter-pill {
  color: #80adfa !important;
}

/* Statistics — same spacing and blue enabled state. */
body#pulsebot-app.dashboard-active-statistics .statistics-control {
  min-height: 84px !important;
  padding: 18px 0 !important;
}

body#pulsebot-app.dashboard-active-statistics .statistics-control-actions {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

body#pulsebot-app.dashboard-active-statistics .statistics-rules {
  margin-top: 10px !important;
}

body#pulsebot-app.dashboard-active-statistics .statistics-rule > summary {
  min-height: 78px !important;
  padding: 18px 2px !important;
}

body#pulsebot-app.dashboard-active-statistics .statistics-rule .rule-options {
  gap: 18px 22px !important;
  padding: 8px 2px 28px 20px !important;
  border-left-color: var(--pb2188-blue-line) !important;
}

body#pulsebot-app.dashboard-active-statistics .stat-variable-help {
  margin-top: 24px !important;
}

@media (max-width: 900px) {
  body#pulsebot-app.dashboard-mode .plan-limit-copy {
    align-items: flex-start !important;
    flex-direction: column !important;
  }

  body#pulsebot-app.dashboard-mode .plan-limit-values {
    justify-content: flex-start !important;
  }

  body#pulsebot-app.dashboard-active-tickets .variable-grid {
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  }
}

@media (max-width: 680px) {
  body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .form-section-head.messages-section-head {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .form-section-head.messages-section-head > .btn {
    width: 100% !important;
  }

  body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-form > .module-savebar {
    inset: auto 12px 12px 12px !important;
  }

  body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .module-save-button {
    width: 100% !important;
    min-width: 0 !important;
  }

  body#pulsebot-app:is(.dashboard-active-tickets,.dashboard-active-messages,.dashboard-active-statistics) .toast {
    right: 12px !important;
    bottom: 72px !important;
    width: calc(100vw - 24px) !important;
  }

  body#pulsebot-app.dashboard-active-tickets .variable-grid {
    grid-template-columns: 1fr !important;
  }

  body#pulsebot-app.dashboard-active-statistics .statistics-control-actions {
    width: 100% !important;
    justify-content: space-between !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body#pulsebot-app.dashboard-mode .btn,
  body#pulsebot-app.dashboard-mode .module-save-button,
  body#pulsebot-app.dashboard-mode .toggle-track {
    transition: none !important;
  }
}
