.notification-center { position: relative; display: inline-flex; align-items: center; }
.notification-center-toggle { position: relative; }
.notification-center-badge {
  position: absolute;
  top: -4px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: .63rem;
  font-weight: 800;
  line-height: 1;
}
.notification-center-badge[hidden] { display: none !important; }
.notification-center-panel {
  position: absolute;
  z-index: 1000;
  top: calc(100% + .65rem);
  right: 0;
  width: min(410px, calc(100vw - 1.5rem));
  max-height: min(72vh, 620px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 32, 60, .2);
}
.notification-center-panel[hidden] { display: none !important; }
.notification-center-panel-head,
.notification-center-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  padding: .8rem .95rem;
}
.notification-center-panel-head { border-bottom: 1px solid #e7edf5; }
.notification-center-panel-head h2 { margin: 0; color: #17243a; font-size: 1rem; }
.notification-center-panel-head .icon-btn { width: 34px; height: 34px; min-width: 34px; }
.notification-center-items { overflow-y: auto; }
.notification-center-item { display: flex; align-items: flex-start; gap: .65rem; padding: .72rem .9rem; border-bottom: 1px solid #edf1f6; }
.notification-center-item:last-child { border-bottom: 0; }
.notification-center-item-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #eaf2ff;
  color: #2467d5;
}
.notification-center-item-body { min-width: 0; flex: 1; }
.notification-center-item-copy { min-width: 0; display: grid; gap: .16rem; }
.notification-center-item-copy strong { color: #17243a; font-size: .84rem; line-height: 1.35; }
.notification-center-item-copy > span:not(.notification-center-item-meta) { color: #596b84; font-size: .78rem; line-height: 1.4; overflow-wrap: anywhere; }
.notification-center-item-meta { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; color: #8794a7; font-size: .7rem; line-height: 1.3; }
.notification-center-item-category { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.notification-center-item-meta time { flex: 0 0 auto; white-space: nowrap; }
.notification-center-item-action { display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; margin-top: .15rem; color: #1767d4; font-size: .76rem; font-weight: 700; text-decoration: none; }
.notification-center-item-action:hover { color: #124da3; text-decoration: underline; }
.notification-center-item-action:focus-visible { outline: 3px solid rgba(37, 99, 235, .25); outline-offset: 2px; }
.notification-center-empty { display: grid; justify-items: center; gap: .35rem; margin: 0; padding: 1.3rem 1rem; color: #6d7e95; text-align: center; font-size: .83rem; }
.notification-center-empty > i { margin-bottom: .2rem; color: #94a5bd; font-size: 1.2rem; }
.notification-center-empty > strong { color: #33445c; font-size: .86rem; }
.notification-center-empty > span { max-width: 28rem; line-height: 1.45; }
.notification-center-empty[hidden] { display: none !important; }
.notification-center-panel-foot { justify-content: center; border-top: 1px solid #e7edf5; }
.notification-center-panel-foot button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 38px; padding: .35rem .65rem; border: 1px solid #dce5f0; border-radius: 8px; background: #fff; color: #245bb0; font: inherit; font-size: .77rem; font-weight: 700; cursor: pointer; }
.notification-center-panel-foot button:hover:not(:disabled) { background: #f6f8fb; }
.notification-center-panel-foot button[hidden] { display: none !important; }
.notification-center-panel-foot button:disabled { opacity: .6; cursor: not-allowed; }
.notification-center-panel-foot button[aria-busy="true"] { cursor: wait; }

.notification-settings-section-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .8rem 1rem; }
.notification-settings-card h2 { margin: 0; color: #14223a; font-size: 1rem; }
.notification-settings-card p { margin: .18rem 0 0; color: #71809a; font-size: .76rem; line-height: 1.4; }

.notification-settings-page { display: grid; gap: 1rem; max-width: 920px; margin: 0 auto; }
.notification-settings-card { padding: 0; overflow: hidden; }
.notification-settings-card-head { display: flex; align-items: flex-start; gap: .85rem; padding: 1.1rem; }
.notification-settings-icon { flex: 0 0 42px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; }
.notification-settings-icon.is-blue { background: #eaf2ff; color: #2467d5; }
.notification-device-information { display: flex; align-items: flex-start; gap: .7rem; margin-top: .9rem; padding: .72rem .85rem; border-radius: 10px; background: #eef5ff; color: #2460b8; }
.notification-device-information[hidden] { display: none !important; }
.notification-device-information[data-state="active"] { background: #ecfdf5; color: #087c4b; }
.notification-device-information[data-state="warning"] { background: #fff8e7; color: #9a5d00; }
.notification-device-information[data-state="error"] { background: #fff1f2; color: #a92c3a; }
.notification-device-information-icon { display: grid; flex: 0 0 22px; width: 22px; height: 22px; place-items: center; margin-top: .08rem; }
.notification-device-information-icon i { font-size: 1rem; }
.notification-device-information>div { display: grid; min-width: 0; gap: .12rem; }
.notification-device-information strong { color: inherit; font-size: .82rem; }
.notification-device-information span:not(.notification-device-information-icon) { color: inherit; font-size: .78rem; line-height: 1.42; overflow-wrap: anywhere; }
.notification-device-actions { display: flex; justify-content: flex-end; min-width: 0; margin-top: .7rem; }
.notification-device-actions:empty { display: none; }
.notification-device-actions [hidden] { display: none !important; }
.notification-settings-section-head { border-bottom: 1px solid #e8edf4; }
.notification-preference-list { display: grid; }
.notification-preference-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .72rem 1.1rem; border-bottom: 1px solid #edf1f6; }
.notification-preference-item:last-child { border-bottom: 0; }
.notification-preference-copy { display: grid; gap: .18rem; }
.notification-preference-copy strong { color: #17243a; font-size: .86rem; }
.notification-preference-copy span { color: #63738b; font-size: .78rem; }
.notification-preference-copy small { color: #7f8da1; font-size: .7rem; }
.notification-preference-item.is-unavailable { opacity: .62; }
.notification-preference-switch { min-width: 0; justify-self: end; }
.notification-preference-status { flex: 0 0 auto; min-width: 5.1rem; color: #23744b; font-size: .72rem; font-weight: 700; text-align: right; }
.notification-preference-item.is-unavailable .notification-preference-status { color: #7d899a; }
.notification-preference-feedback { padding: 0 1.1rem 1rem; color: #23744b !important; }
.notification-preference-feedback.is-error { color: #ae2f3a !important; }

/* No Dashboard, mantenha o sino entre o filtro de período e as configurações. */
.main-panel-dashboard .topbar-actions.module-header-actions > .dash-period-toolbar { order: 1; }
.main-panel-dashboard .topbar-actions.module-header-actions > .notification-center { order: 2; }
.main-panel-dashboard .topbar-actions.module-header-actions > .config-panel-btn { order: 3; }
.main-panel-dashboard .app-topbar:has(.notification-center-panel.is-open) {
  border-bottom: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

@media (max-width: 768px) {
  .main-panel-dashboard .topbar:has(.dash-period-toolbar .fin-period-custom.is-visible) {
    grid-template-columns: var(--mobile-control) minmax(0, 1fr) var(--mobile-control) var(--mobile-control) !important;
  }
  .main-panel-dashboard .topbar:has(.dash-period-toolbar .fin-period-custom.is-visible) .notification-center {
    grid-column: 3;
    grid-row: 1;
    align-self: start;
    justify-self: end;
  }
  .main-panel-dashboard .topbar:has(.dash-period-toolbar .fin-period-custom.is-visible) .config-panel-btn {
    grid-column: 4;
    grid-row: 1;
  }
}

@media (max-width: 680px) {
  .notification-center-panel { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 4.5rem); right: .65rem; width: calc(100vw - 1.3rem); max-height: calc(100dvh - 6rem); }
  .notification-settings-section-head { align-items: flex-start; flex-direction: column; }
  .notification-preference-item { align-items: flex-start; flex-direction: column; }
}

/* Painel lateral compartilhado entre o Dashboard e a Agenda. */
.notification-panel-backdrop {
  position: fixed;
  z-index: 88;
  inset: 0;
  background: rgba(15, 23, 42, .38);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.notification-panel-backdrop[hidden] { display: none !important; }
.notification-panel-backdrop.is-open { opacity: 1; pointer-events: auto; }
.notification-panel {
  position: fixed;
  z-index: 89;
  inset: 0 0 0 auto;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  border: 0;
  border-left: 1px solid #e1e8f2;
  border-radius: 0;
  background: #fff;
  box-shadow: -18px 0 44px rgba(15, 32, 60, .18);
  transform: translateX(105%);
  visibility: hidden;
  pointer-events: none;
  transition: transform .22s ease, visibility .22s ease;
}
.notification-panel.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}
.notification-panel-head {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 76px;
  padding: calc(.85rem + env(safe-area-inset-top, 0px)) calc(1rem + env(safe-area-inset-right, 0px)) .85rem calc(1rem + env(safe-area-inset-left, 0px));
  border-bottom: 1px solid #e8edf4;
  background: #fff;
}
.notification-panel-heading-copy { display: grid; gap: .18rem; min-width: 0; }
.notification-panel-head h2 { margin: 0; color: #17243a; font-size: 1rem; line-height: 1.3; }
.notification-panel-head p { margin: 0; color: #71809a; font-size: .8rem; line-height: 1.4; }
.notification-panel-close {
  display: inline-flex;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid #dce5f0;
  border-radius: 10px;
  background: #fff;
  color: #526b90;
  cursor: pointer;
}
.notification-panel-close:hover,
.notification-panel-close:focus-visible { border-color: #b9cbe2; background: #f5f8fc; color: #17243a; }
.notification-panel-close:focus-visible { outline: 3px solid rgba(37, 99, 235, .2); outline-offset: 2px; }
.notification-panel-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.notification-center-panel { padding: 0; }
.notification-center-items { display: block; }
.notification-center-items:empty { flex: 0 0 0; overflow: hidden; }
.notification-center-empty {
  flex: 1 1 auto;
  align-content: center;
  min-height: 210px;
  padding: 1.5rem 1rem;
}
.notification-panel-foot {
  flex: 0 0 auto;
  min-height: 54px;
  padding: .8rem calc(1rem + env(safe-area-inset-right, 0px)) calc(.8rem + env(safe-area-inset-bottom, 0px)) calc(1rem + env(safe-area-inset-left, 0px));
  border-top: 1px solid #e8edf4;
  background: #fff;
}
.agenda-notifications-drawer.notification-panel { padding: 0; }
.agenda-notifications-drawer .agenda-notifications-head { align-items: center; }
.agenda-notifications-drawer .agenda-notifications-list {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: .85rem calc(.85rem + env(safe-area-inset-right, 0px)) calc(1rem + env(safe-area-inset-bottom, 0px)) calc(.85rem + env(safe-area-inset-left, 0px));
}
.agenda-notifications-drawer .agenda-notifications-empty {
  align-content: center;
  flex: 1 0 180px;
  margin-block: auto;
}
.agenda-notification-badge {
  top: -4px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #2563eb;
  box-shadow: none;
  color: #fff;
  font: 800 .63rem/1 "Inter", sans-serif;
}
body.notification-panel-open { overflow: hidden; overscroll-behavior: none; }

@media (max-width: 680px) {
  .notification-panel { width: 100%; }
  .notification-panel-head { min-height: 68px; }
  .notification-panel-close { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
}

/* Preferências: toggles simples por categoria e painel push para dispositivo. */
.notification-settings-page {
  width: min(100%, 1280px);
  max-width: 1280px;
  margin-inline: auto;
  gap: 1.15rem;
}

.notification-device-card,
.notification-preferences-card {
  overflow: hidden;
  border: 1px solid #dce5f1;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(22, 42, 73, .07);
}

.notification-device-card { padding: 1.15rem; }
.notification-device-main {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
}
.notification-device-main .notification-settings-icon {
  width: 64px;
  height: 64px;
  border-radius: 15px;
  font-size: 1.25rem;
}
.notification-device-copy { min-width: 0; }
.notification-settings-section-head h2 { font-size: 1.08rem; }
.notification-device-copy p { max-width: 42rem; margin: 0; color: #63738b; font-size: .9rem; line-height: 1.45; }
.notification-settings-section-head p { font-size: .87rem; }
.notification-device-switch { align-self: start; margin-top: .2rem; }
.notification-device-switch .notification-switch { flex-basis: 54px; width: 54px; }
.notification-push-test { flex: 0 0 auto; }

.notification-switch-control {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: #6e7e95;
  cursor: pointer;
  white-space: nowrap;
}
.notification-switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.notification-switch {
  position: relative;
  display: inline-block;
  flex: 0 0 54px;
  width: 54px;
  height: 32px;
  border-radius: 999px;
  background: #c8ced5;
  transition: background-color .18s ease;
}
.notification-switch::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  content: "";
  transition: transform .18s ease;
}
.notification-switch-control input:checked + .notification-switch { background: #10b981; }
.notification-switch-control input:checked + .notification-switch::after { transform: translateX(22px); }
.notification-switch-control input:focus-visible + .notification-switch { outline: 3px solid rgba(37, 99, 235, .24); outline-offset: 2px; }
.notification-switch-control input:disabled + .notification-switch { background: #d8dde3; cursor: not-allowed; }
.notification-switch-control input:disabled ~ * { opacity: .65; cursor: not-allowed; }
.notification-preference-state { min-width: 4.2rem; color: #74839a; font-size: .78rem; }
.notification-switch-control input:checked ~ .notification-preference-state { color: #07834e; font-weight: 700; }

.notification-settings-section-head {
  justify-content: flex-start;
  padding: 1rem 1.15rem;
}
.notification-settings-section-head .notification-settings-icon {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 1.15rem;
}
.notification-settings-icon.is-cyan { background: #e5f9fc; color: #0ba6b8; }
.notification-preference-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: .9rem;
  min-height: 74px;
  padding: .55rem 1.15rem;
  border-bottom: 1px solid #e8edf4;
}
.notification-preference-item:last-child { border-bottom: 0; }
.notification-preference-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 14px;
  font-size: 1.15rem;
}
.notification-preference-icon.is-blue { background: #eaf2ff; color: #2773e6; }
.notification-preference-icon.is-orange { background: #fff3df; color: #ef8b00; }
.notification-preference-icon.is-violet { background: #f2eaff; color: #8239e9; }
.notification-preference-icon.is-green { background: #e5faf1; color: #0ca56b; }
.notification-settings-page .notification-settings-icon i,
.notification-settings-page .notification-preference-icon i,
.notification-settings-page .notification-device-information-icon i {
  font-size: 1.15rem;
  line-height: 1;
}
.notification-preference-copy { display: grid; min-width: 0; gap: .2rem; }
.notification-preference-copy strong { color: #17243a; font-size: .9rem; }
.notification-preference-copy span { color: #63738b; font-size: .82rem; line-height: 1.4; }
.notification-preference-copy small { color: #8a96a8; font-size: .74rem; }
.notification-preference-switch { min-width: 8.5rem; justify-content: flex-end; }
.notification-preference-status { color: #76849a; font-size: .78rem; font-weight: 700; }
.notification-preferences-footer { padding: 1rem 1.15rem; border-top: 1px solid #e8edf4; }
.notification-preferences-save { min-height: 48px; }
.notification-preference-feedback { padding: 0; margin: 0 0 .75rem !important; }
.notification-preference-feedback[hidden] { display: none !important; }

@media (max-width: 760px) {
  .notification-settings-page { width: 100%; gap: .85rem; }
  .notification-device-card { padding: .9rem; }
  .notification-device-main { grid-template-columns: 48px minmax(0, 1fr) auto; align-items: start; gap: .65rem; }
  .notification-device-main .notification-settings-icon { width: 48px; height: 48px; border-radius: 12px; }
  .notification-device-switch { grid-column: auto; justify-self: end; margin-top: .08rem; }
  .notification-device-switch .notification-switch { flex-basis: 48px; width: 48px; height: 28px; }
  .notification-device-switch input:checked + .notification-switch::after { transform: translateX(20px); }
  .notification-device-copy p { max-width: 34rem; font-size: .88rem; }
  .notification-device-information { margin-top: .75rem; padding: .68rem .75rem; }
  .notification-device-actions { justify-content: stretch; }
  .notification-push-test { width: 100%; }
  .notification-settings-section-head { flex-wrap: nowrap; padding: .85rem; }
  .notification-settings-section-head .notification-settings-icon { flex-basis: 44px; width: 44px; height: 44px; }
  .notification-preferences-heading { align-items: center; flex-direction: row; justify-content: flex-start; gap: .7rem; }
  .notification-preferences-heading>div { min-width: 0; }
  .notification-preference-item { grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: .65rem; padding: .65rem .85rem; }
  .notification-preference-icon { width: 44px; height: 44px; border-radius: 12px; font-size: 1rem; }
  .notification-preference-switch { min-width: 0; gap: .35rem; }
  .notification-preference-state { display: none; }
  .notification-switch { flex-basis: 48px; width: 48px; height: 28px; }
  .notification-switch::after { width: 20px; height: 20px; }
  .notification-switch-control input:checked + .notification-switch::after { transform: translateX(20px); }
  .notification-preferences-footer { padding: .85rem; }
}

@media (min-width: 1025px) {
  .notification-settings-page .notification-device-copy p {
    color: #17243a;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.35;
  }
}

/* Normalize the visible icon glyphs across device, heading and category cards. */
.notification-settings-page .notification-settings-icon i,
.notification-settings-page .notification-preference-icon i,
.notification-settings-page .notification-device-information-icon i {
  display: inline-flex !important;
  width: 22px !important;
  height: 22px !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 22px !important;
  line-height: 1 !important;
}
