.notification-settings {
  display: grid;
  gap: 16px;
}

.notification-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
}

.notification-master {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 750;
}

.notification-switch {
  appearance: none;
  width: 42px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: #cbd7e0;
  cursor: pointer;
  position: relative;
  transition: .18s;
}

.notification-switch::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px #7990a455;
  transition: .18s;
}

.notification-switch:checked { background: #4b98cf; }
.notification-switch:checked::after { transform: translateX(18px); }
.notification-group { overflow: hidden; }

.notification-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 0;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.notification-group-head h3 { margin: 0 0 5px; font-size: 15px; }
.notification-group-head p { margin: 0; color: #718390; font-size: 12px; }
.notification-group-meta { display: flex; align-items: center; gap: 10px; color: #6f8494; font-size: 11px; white-space: nowrap; }
.notification-group-body { display: grid; gap: 10px; padding: 0 20px 20px; }
.notification-item-wrap { display: grid; min-width: 0; gap: 0; }
.notification-item-wrap.is-open .notification-item { border-radius: 14px 14px 0 0; border-bottom: 0; }

.notification-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 4px 18px;
  padding: 16px;
  border: 1px solid #e0e8ef;
  border-radius: 14px;
  background: #f9fbfd;
}

.notification-item:hover { border-color: #bcd8eb; }
.notification-item-hitarea { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; padding: 0; border: 0; border-radius: inherit; background: transparent; cursor: pointer; }
.notification-item-hitarea:focus-visible { outline: 3px solid #4b98cf; outline-offset: 2px; }
.notification-item-main, .notification-item-description, .notification-item-state, .notification-item-actions { position: relative; z-index: 2; pointer-events: none; }
.notification-item-main { grid-column: 1; grid-row: 1; }
.notification-item-description { grid-column: 1; grid-row: 2; }
.notification-item-state { display: flex; align-items: center; flex: 0 0 auto; grid-column: 2; grid-row: 1 / 3; gap: 8px; white-space: nowrap; }
.notification-item-actions { grid-column: 3; grid-row: 1 / 3; }
.notification-item-state .notification-switch, .notification-item-actions button { pointer-events: auto; }
.notification-item h4 { margin: 0; font-size: 14px; }
.notification-item p { margin: 0; color: #718390; font-size: 11px; line-height: 1.55; }
.notification-item-actions { display: flex; align-items: center; justify-content: flex-start; gap: 8px; flex-wrap: nowrap; }
.notification-item-actions button { white-space: nowrap; }
.notification-configured { padding: 5px 9px; border-radius: 999px; background: #edf5fb; color: #337aad; font-size: 10px; font-weight: 750; }
.notification-configured.is-empty { background: #f2f4f6; color: #87949d; }

.notification-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  color: var(--text, #17273a);
  background: #fff;
  box-shadow: 0 24px 70px #23425c45;
}

.notification-dialog::backdrop { background: #18344b66; backdrop-filter: blur(4px); }
.notification-dialog-body { padding: 26px; }
.notification-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.notification-dialog-head small { color: #4b98cf; font-size: 10px; font-weight: 760; letter-spacing: .08em; }
.notification-dialog-head h2 { margin: 5px 0 0; color: #243746; font-size: 21px; }
.notification-dialog-close { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #dbe5ec; border-radius: 9px; color: #7e8d99; background: #f8fafc; font-size: 21px; cursor: pointer; }

.notification-template { margin-top: 18px; }
.notification-template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.notification-template-card { min-width: 0; padding: 16px; border: 1px solid #d8e4f2; border-radius: 13px; background: #f7faff; }
.notification-template-card.is-fault { border-color: #f0ddc7; background: #fffaf5; }
.notification-template-card.is-recovery { border-color: #d6e9df; background: #f6fbf8; }
.notification-template-card > span { display: block; margin-bottom: 10px; color: #7a8995; font-size: 10px; }
.notification-template-card > h3 { margin: 0; color: #2f3f4d; font-size: 14px; }
.notification-template-card > pre {
  min-height: 0;
  margin: 12px 0 0;
  padding: 0;
  overflow: visible;
  color: #556977;
  background: transparent;
  font: 12px/1.75 inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.notification-summary-list { display: grid; gap: 8px; }
.notification-summary-row { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(230px, 1.2fr); gap: 16px; padding: 11px 13px; border: 1px solid #d7e3ed; border-radius: 11px; background: #fff; }
.notification-summary-row strong { color: #263846; }
.notification-summary-row span { color: #30485b; font-weight: 700; }
.notification-summary-row span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: #55a5de; box-shadow: 0 0 0 3px #eaf5fc; }

.notification-history-state { margin: 20px 0 0; padding: 18px; border: 1px solid #dbe6ef; border-radius: 12px; background: #f7faff; color: #536c7e; font-size: 13px; line-height: 1.6; }
.notification-history-inline { min-width: 0; padding: 12px 16px 16px; border: 1px solid #dbe6ef; border-radius: 0 0 14px 14px; background: #fff; }
.notification-history-inline-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; color: #536c7e; }
.notification-history-inline-head strong { color: #263846; font-size: 13px; }
.notification-history-inline-head span { font-size: 11px; }
.notification-history-inline .notification-history-state { margin: 9px 0 0; padding: 12px; }
.notification-history-inline .notification-history-list { margin-top: 10px; }
.notification-history-state p { margin: 0 0 12px; }
.notification-history-list { display: grid; gap: 12px; margin-top: 18px; }
.notification-history-entry { min-width: 0; padding: 16px; border: 1px solid #dbe6ef; border-radius: 12px; background: #f9fbfd; }
.notification-history-entry-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; }
.notification-history-entry-head > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.notification-history-entry-head strong { color: #263846; font-size: 13px; }
.notification-history-entry-head time { color: #758794; font-size: 11px; }
.notification-history-status { padding: 3px 8px; border-radius: 999px; background: #eef4f8; color: #567087; font-size: 10px; font-weight: 750; }
.notification-history-status.is-succeeded { background: #e9f6ee; color: #267348; }
.notification-history-status.is-failed { background: #fff0e8; color: #aa5636; }
.notification-history-entry pre { min-height: 0; height: auto; margin: 13px 0; padding: 12px; border-radius: 9px; background: #fff; color: #30485b; font: 12px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.notification-history-entry dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 0; }
.notification-history-entry dl > div { display: flex; min-width: 0; gap: 8px; font-size: 11px; }
.notification-history-entry dt { flex: 0 0 auto; color: #758794; }
.notification-history-entry dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: #30485b; }

.notification-form { display: grid; gap: 10px; margin-top: 18px; }
.notification-form input { width: 100%; padding: 12px; border: 1px solid #cfdce6; border-radius: 10px; }
.notification-error { min-height: 18px; color: #bd4b45; font-size: 11px; }
.notification-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; padding-top: 18px; border-top: 1px solid #e1e8ee; }
.notification-loading { padding: 30px; text-align: center; color: #718390; }
.notification-failure { padding: 20px; color: #9b4c43; background: #fff7f3; border: 1px solid #f0d7ce; border-radius: 14px; }

@media (max-width: 760px) {
  .notification-settings { gap: 12px; }
  .notification-toolbar, .notification-group-head { align-items: flex-start; }
  .notification-toolbar { padding: 16px; }
  .notification-master { font-size: 12px; }
  .notification-group-head { padding: 16px; }
  .notification-group-body { padding: 0 12px 14px; }
  .notification-item { grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 14px; }
  .notification-item-main { grid-column: 1; grid-row: 1; }
  .notification-item-state { grid-column: 2; grid-row: 1; }
  .notification-item-description { grid-column: 1 / -1; grid-row: 2; }
  .notification-item-actions { grid-column: 1 / -1; grid-row: 3; }
  .notification-item-actions button { flex: 1 1 0; min-width: 0; padding: 8px 4px; font-size: 11px; }
  .notification-history-inline { padding: 10px 12px 12px; }
  .notification-history-entry { padding: 12px; }
  .notification-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); border-radius: 16px; }
  .notification-dialog-body { padding: 18px; }
  .notification-dialog-head h2 { font-size: 18px; }
  .notification-template-grid { grid-template-columns: 1fr; }
  .notification-summary-row { grid-template-columns: 1fr; gap: 5px; }
  .notification-history-entry dl { grid-template-columns: 1fr; }
}
