/* ==========================================================================
   JMOS — Modals, Cascade Deal-Won Flow & Toast Notifications
   ========================================================================== */

/* Standard Modal Overlay & Dialog */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.on {
  display: flex !important;
}

.mbg {
  position: absolute;
  inset: 0;
  background: rgba(28, 22, 20, .65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.mbox {
  position: relative;
  background: var(--surface, #ffffff);
  border-radius: 16px;
  box-shadow: 0 24px 60px -22px rgba(28, 22, 20, .36);
  width: 60vw;
  min-width: 580px;
  max-width: 90vw;
  padding: 28px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 2;
  animation: modalPop .22s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 768px) {
  .mbox {
    width: 95vw;
    min-width: 0;
    padding: 20px;
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(.95) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.mclose {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--muted, #6E6763);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.mclose:hover {
  background: var(--paper, #FAF7F6);
  color: var(--ink, #1C1614);
}

.mbox h3 {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 19px;
  margin-bottom: 4px;
  padding-right: 32px;
  color: var(--ink, #1C1614);
}

.mbox .msub {
  color: var(--muted, #6E6763);
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.4;
}

/* Modal Form Fields */
.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #4A4340;
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong, #DCD4D1);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
  background: var(--surface, #ffffff);
  color: var(--ink, #1C1614);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}

.field select {
  cursor: pointer;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--red, #C52523);
  box-shadow: 0 0 0 3px var(--red-soft, #FBEAE8);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--faint, #9A928E);
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .grid2 {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.mfoot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line, #ECE6E4);
}

/* Deal-Won Cascade Sequence Modal */
.cascade {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cascade.on {
  display: flex !important;
}

.cbg {
  position: absolute;
  inset: 0;
  background: rgba(28, 22, 20, .65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.cbox {
  position: relative;
  background: var(--surface, #ffffff);
  border-radius: 18px;
  box-shadow: 0 24px 60px -22px rgba(28, 22, 20, .36);
  width: 450px;
  max-width: 100%;
  padding: 26px;
  overflow: hidden;
  animation: modalPop .22s cubic-bezier(0.16, 1, 0.3, 1);
}

.cbox::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--red-bright, #E23A2E), var(--red-deep, #9E1B21));
}

.cbox h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--ink, #1C1614);
}

.cbox .lede {
  color: var(--muted, #6E6763);
  font-size: 13px;
  margin: 6px 0 18px;
}

.cbox .lede b {
  color: var(--red, #C52523);
  font-weight: 600;
}

.cstep {
  display: flex;
  gap: 13px;
  padding: 10px 0;
  align-items: center;
  opacity: .35;
  transform: translateY(4px);
  transition: opacity .4s ease, transform .4s ease;
}

.cstep.done {
  opacity: 1;
  transform: none;
}

.cstep .ck {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--paper, #FAF7F6);
  border: 1px solid var(--line, #ECE6E4);
  display: grid;
  place-items: center;
  flex: none;
  transition: background .3s, border-color .3s;
}

.cstep.done .ck {
  background: var(--green, #1C7A4E);
  border-color: var(--green, #1C7A4E);
}

.cstep .ck svg {
  width: 14px;
  height: 14px;
  stroke: var(--faint, #9A928E);
  stroke-width: 2.4;
  fill: none;
  transition: stroke .3s;
}

.cstep.done .ck svg {
  stroke: #fff;
}

.cstep .ct {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink, #1C1614);
}

.cstep .ct small {
  display: block;
  color: var(--muted, #6E6763);
  font-weight: 400;
  font-size: 12px;
  margin-top: 1px;
}

.cfoot {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

/* Toast Alerts */
.toasts {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: max-content;
  max-width: 92vw;
  pointer-events: none;
}

.toast {
  background: var(--ink, #1C1614);
  color: #F5EFED;
  border-radius: 12px;
  padding: 13px 18px;
  box-shadow: 0 12px 36px -10px rgba(0, 0, 0, .4);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 280px;
  pointer-events: auto;
  animation: rise .35s cubic-bezier(.2, .7, .3, 1);
}

@keyframes rise {
  from {
    transform: translateY(14px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.toast .tk {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--green, #1C7A4E);
  display: grid;
  place-items: center;
  flex: none;
  margin-top: 1px;
}

.toast .tk svg {
  width: 13px;
  height: 13px;
  stroke: #fff;
  stroke-width: 2.4;
  fill: none;
}

.toast .tk.red {
  background: var(--red, #C52523);
}

.toast b {
  font-size: 13px;
  font-weight: 600;
  display: block;
}

.toast small {
  font-size: 12px;
  color: #B9AFAC;
  display: block;
  margin-top: 1px;
}

/* ==========================================================================
/* ==========================================================================
   JMOS — Operational Notifications Center Popover
   Anchored directly at the topbar notification bell icon
   ========================================================================== */
.notif-dropdown-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.icon-btn.notif-bell-btn {
  cursor: pointer;
  transition: all .18s ease;
}

.icon-btn.notif-bell-btn.active,
.icon-btn.notif-bell-btn:hover {
  background: var(--surface-2, rgba(255, 255, 255, 0.08));
  border-color: var(--line-strong, #473833);
}

.notif-popover-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 440px;
  max-width: min(440px, calc(100vw - 28px));
  background: var(--surface, #1e1816);
  border: 1px solid var(--line, #2c2421);
  border-radius: 14px;
  box-shadow: 0 16px 44px -8px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  max-height: min(560px, calc(100vh - 80px));
  transform-origin: top right;
  animation: notifPopoverDrop .2s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-popover-panel.open {
  display: flex !important;
}

/* Upward pointer arrow centered directly under the 36px bell */
.notif-popover-panel::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 12px;
  width: 10px;
  height: 10px;
  background: var(--surface, #1e1816);
  border-left: 1px solid var(--line, #2c2421);
  border-top: 1px solid var(--line, #2c2421);
  transform: rotate(45deg);
  z-index: 3;
}

@keyframes notifPopoverDrop {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.notif-panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line, #2c2421);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface, #1e1816);
  position: relative;
  z-index: 4;
}

.notif-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-head-title svg {
  stroke: var(--ink, #fff);
}

.notif-head-title h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink, #fff);
  margin: 0;
}

.notif-unread-pill {
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(197, 37, 35, 0.15);
  color: var(--red, #C52523);
  border: 1px solid rgba(197, 37, 35, 0.3);
  padding: 1px 8px;
  border-radius: 10px;
}

.notif-head-close-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted, #948885);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s ease;
}

.notif-head-close-btn:hover {
  background: var(--surface-2, rgba(255, 255, 255, 0.06));
  color: var(--ink, #fff);
}

.notif-tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface-2, rgba(255, 255, 255, 0.02));
  border-bottom: 1px solid var(--line, #2c2421);
  gap: 8px;
}

.notif-segmented {
  display: inline-flex;
  background: var(--paper, #141110);
  border: 1px solid var(--line, #2c2421);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.notif-tab-btn {
  background: none;
  border: none;
  color: var(--muted, #948885);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s ease;
}

.notif-tab-btn:hover {
  color: var(--ink, #fff);
}

.notif-tab-btn.active {
  background: var(--surface, #241d1a);
  color: var(--ink, #fff);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.notif-tab-badge {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--line, #3a2e2a);
  color: var(--ink, #fff);
}

.notif-tab-btn.active .notif-tab-badge {
  background: var(--red, #C52523);
  color: #fff;
}

.notif-mark-all-btn {
  background: none;
  border: none;
  color: var(--muted, #948885);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color .15s;
}

.notif-mark-all-btn:hover {
  color: var(--ink, #fff);
  text-decoration: underline;
}

.notif-list-container {
  overflow-y: auto;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 52vh;
}

.notif-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface, #1e1816);
  border: 1px solid var(--line, #2c2421);
  border-radius: 12px;
  position: relative;
  transition: all .15s ease;
}

.notif-card:hover {
  border-color: var(--line-strong, #473833);
  transform: translateY(-1px);
}

.notif-card.unread {
  background: rgba(197, 37, 35, 0.04);
  border-color: rgba(197, 37, 35, 0.28);
}

.notif-card.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3.5px;
  background: var(--red, #C52523);
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.notif-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.notif-icon-wrap svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.notif-icon-wrap.type-calendar {
  background: rgba(26, 115, 232, 0.15);
  color: #4285f4;
}

.notif-icon-wrap.type-system {
  background: rgba(197, 37, 35, 0.15);
  color: #C52523;
}

.notif-icon-wrap.type-invoice {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.notif-icon-wrap.type-chat {
  background: rgba(138, 90, 43, 0.15);
  color: #d97706;
}

.notif-icon-wrap.type-deal {
  background: rgba(28, 122, 78, 0.15);
  color: #1C7A4E;
}

.notif-body-wrap {
  flex: 1;
  min-width: 0;
}

.notif-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.notif-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink, #fff);
  display: flex;
  align-items: center;
  gap: 6px;
}

.notif-dot-unread {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red, #C52523);
  display: inline-block;
}

.notif-item-time {
  font-size: 11px;
  color: var(--muted, #948885);
  white-space: nowrap;
}

.notif-item-msg {
  font-size: 12.5px;
  color: var(--muted-strong, #cfc6c3);
  line-height: 1.45;
  margin-bottom: 8px;
  word-break: break-word;
}

.notif-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.notif-btn-toggle {
  background: var(--paper, #141110);
  border: 1px solid var(--line, #2c2421);
  color: var(--ink, #fff);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
}

.notif-btn-toggle:hover {
  background: var(--surface, #241d1a);
  border-color: var(--line-strong, #473833);
}

.notif-btn-link {
  background: rgba(26, 115, 232, 0.12);
  border: 1px solid rgba(26, 115, 232, 0.3);
  color: #4285f4;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: all .15s;
}

.notif-btn-link:hover {
  background: rgba(26, 115, 232, 0.22);
  color: #fff;
}

.notif-btn-del {
  background: none;
  border: none;
  color: var(--muted, #948885);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  transition: color .15s;
}

.notif-btn-del:hover {
  color: var(--red, #C52523);
}

.notif-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted, #948885);
}

.notif-empty-state svg {
  width: 44px;
  height: 44px;
  stroke: var(--muted, #948885);
  stroke-width: 1.5;
  fill: none;
  margin-bottom: 12px;
  opacity: 0.6;
}

.notif-empty-state h4 {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink, #fff);
  margin-bottom: 4px;
}

.notif-empty-state p {
  font-size: 12px;
  margin: 0;
}

.notif-modal-foot,
.notif-panel-foot {
  padding: 10px 16px;
  background: var(--surface-2, rgba(255, 255, 255, 0.02));
  border-top: 1px solid var(--line, #2c2421);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
