:root {
  --notification-surface: #0d1c30;
  --notification-surface-soft: #0a1728;
  --notification-line: #29425f;
  --notification-blue: #55a7ff;
  --notification-mint: #42d9ae;
  --notification-amber: #f3ba5b;
  --notification-rose: #fb7185;
}

.notification-shell {
  width: min(1180px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 28px) 120px;
}

.notification-topbar,
.notification-header-actions,
.section-heading,
.telegram-layout,
.telegram-actions,
.monitor-state-line,
.save-bar-actions {
  display: flex;
  align-items: center;
}

.notification-topbar {
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--notification-line);
}

.notification-product-name {
  margin: 0;
  color: #f4f8ff;
  font-size: 1.08rem;
  font-weight: 900;
}

.notification-header-actions {
  justify-content: flex-end;
  gap: 12px;
}

.notification-header-actions .global-page-nav {
  margin-top: 0;
}

.notification-message {
  padding: 22px;
  border: 1px solid var(--notification-line);
  border-radius: 13px;
  background: var(--notification-surface);
  color: #bdd0e5;
}

.notification-message p {
  margin-top: 0;
}

.notification-message-error {
  border-color: #7a3850;
  color: #ffc0ca;
}

.notification-hero,
.notification-section,
.notification-advanced {
  border: 1px solid var(--notification-line);
  border-radius: 14px;
  background: var(--notification-surface);
}

.notification-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr);
  gap: 18px;
  margin-bottom: 18px;
  padding: clamp(18px, 3vw, 28px);
}

.notification-hero-copy {
  min-width: 0;
}

.notification-hero-copy h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
}

.notification-hero-copy > p:last-child {
  max-width: 70ch;
  margin: 10px 0 0;
  color: #abc1d8;
  line-height: 1.75;
}

.monitor-state-card {
  display: grid;
  align-content: start;
  gap: 13px;
  padding: 16px;
  border: 1px solid #385470;
  border-radius: 12px;
  background: #081727;
}

.monitor-state-line {
  gap: 11px;
}

.monitor-state-dot {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: #73849a;
  box-shadow: 0 0 0 5px #73849a18;
}

.monitor-state-card[data-state="active"] .monitor-state-dot {
  background: var(--notification-mint);
  box-shadow: 0 0 0 5px #42d9ae1c;
}

.monitor-state-card[data-state="warning"] .monitor-state-dot,
.monitor-state-card[data-state="blocked"] .monitor-state-dot {
  background: var(--notification-amber);
  box-shadow: 0 0 0 5px #f3ba5b1c;
}

.monitor-state-card[data-state="error"] .monitor-state-dot {
  background: var(--notification-rose);
  box-shadow: 0 0 0 5px #fb71851c;
}

.status-caption {
  display: block;
  color: #8da6bf;
  font-size: .68rem;
}

#monitorStateLabel {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  font-size: 1.2rem;
}

.compact-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  min-height: 38px;
  color: #e8f4ff;
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
}

.compact-switch input {
  position: relative;
  display: block;
  flex: 0 0 36px;
  width: 36px;
  min-width: 36px;
  height: 20px;
  min-height: 20px;
  margin: 0;
  padding: 0;
  appearance: none;
  vertical-align: middle;
  border: 1px solid #52667b;
  border-radius: 999px;
  background: #243244;
  transition: background .15s ease, border-color .15s ease;
}

.compact-switch input::before {
  position: absolute;
  top: 50%;
  left: 2px;
  display: block;
  width: 14px;
  height: 14px;
  margin: 0;
  border-radius: 50%;
  background: #aebaca;
  content: "";
  transform: translateY(-50%);
  transition: transform .15s ease, background .15s ease;
}

.compact-switch input:checked {
  border-color: #45b98e;
  background: #167358;
}

.compact-switch input:checked::before {
  transform: translate(16px, -50%);
  background: #fff;
}

.compact-switch input:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.compact-help,
.inline-status,
.empty-copy {
  margin: 0;
  color: #93a9bf;
  font-size: .75rem;
  line-height: 1.6;
}

.inline-status[data-state="error"] {
  color: #ffb8c3;
}

.inline-status[data-state="success"] {
  color: #82e6c1;
}

.inline-status[data-state="warning"] {
  color: #ffd27d;
}

.monitor-facts {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0;
  border: 1px solid #263f5a;
  border-radius: 11px;
  overflow: hidden;
}

.monitor-facts div {
  min-width: 0;
  padding: 11px 12px;
  border-right: 1px solid #263f5a;
  background: #091827;
}

.monitor-facts div:last-child {
  border-right: 0;
}

.monitor-facts dt,
.telegram-facts dt,
.rule-summary dt {
  color: #8fa6bd;
  font-size: .67rem;
}

.monitor-facts dd,
.telegram-facts dd,
.rule-summary dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  color: #f1f7ff;
  font-size: .82rem;
  font-weight: 850;
}

.runtime-warnings {
  grid-column: 1 / -1;
  display: grid;
  gap: 7px;
}

.runtime-warning {
  padding: 10px 12px;
  border-left: 3px solid var(--notification-amber);
  background: #302510;
  color: #ffdfa0;
  font-size: .76rem;
  line-height: 1.6;
}

.runtime-warning[data-level="error"] {
  border-left-color: var(--notification-rose);
  background: #351724;
  color: #ffc2cd;
}

#notificationSettingsForm {
  display: grid;
  gap: 18px;
}

.notification-section {
  min-width: 0;
  padding: clamp(16px, 2.5vw, 22px);
}

.section-heading {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-heading > div {
  min-width: 0;
}

.section-heading h2 {
  margin: 1px 0 0;
  font-size: 1.05rem;
}

.section-heading p:not(.section-number) {
  max-width: 74ch;
  margin: 5px 0 0;
  color: #91a8c0;
  font-size: .76rem;
  line-height: 1.65;
}

.section-number {
  display: inline-grid;
  place-items: center;
  float: left;
  width: 24px;
  height: 24px;
  margin: 0 9px 0 0;
  border: 1px solid #3f72a5;
  border-radius: 7px;
  color: #bfe2ff;
  font-size: .72rem;
  font-weight: 900;
}

.state-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid #51657c;
  border-radius: 999px;
  background: #17263a;
  color: #c6d4e3;
  font-size: .7rem;
  font-weight: 850;
}

.state-badge[data-state="connected"],
.state-badge[data-state="tested"] {
  border-color: #24886c;
  background: #103c31;
  color: #86edc8;
}

.state-badge[data-state="warning"] {
  border-color: #9b732e;
  background: #3a2b12;
  color: #ffda90;
}

.state-badge[data-state="error"] {
  border-color: #9b4058;
  background: #3d1826;
  color: #ffbdc8;
}

.telegram-layout {
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
}

.telegram-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(125px, 1fr));
  flex: 1 1 auto;
  margin: 0;
  border: 1px solid #29425f;
  border-radius: 10px;
  overflow: hidden;
}

.telegram-facts div {
  min-width: 0;
  padding: 11px 13px;
  border-right: 1px solid #29425f;
  background: var(--notification-surface-soft);
}

.telegram-facts div:last-child {
  border-right: 0;
}

.telegram-actions {
  flex: 0 1 auto;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.telegram-actions .button {
  min-height: 40px;
}

.button.quiet-danger {
  border: 1px solid #744056;
  background: #281724;
  color: #ffc0cc;
  font-weight: 850;
}

.button.quiet-danger:hover:not(:disabled) {
  background: #3a1b2a;
}

.pairing-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 13px;
  border: 1px solid #3f75a7;
  border-radius: 10px;
  background: #102a44;
}

.pairing-panel p {
  margin: 4px 0 0;
  color: #a8c8e5;
  font-size: .72rem;
}

.sample-notification-section {
  border-color: #35608a;
  background:
    linear-gradient(135deg, #10243b 0%, var(--notification-surface) 52%),
    var(--notification-surface);
}

.sample-disclosure-summary {
  margin: 0;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.sample-disclosure-summary::-webkit-details-marker {
  display: none;
}

.sample-disclosure-summary:focus-visible {
  outline: 2px solid #58adff;
  outline-offset: 6px;
  border-radius: 8px;
}

.sample-notification-section[open] .sample-disclosure-summary {
  margin-bottom: 16px;
}

.sample-section-heading {
  align-items: flex-start;
}

.sample-summary-status {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.sample-disclosure-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 68px;
  color: #b9d8f4;
  font-size: .7rem;
  font-weight: 850;
  white-space: nowrap;
}

.sample-disclosure-toggle::before {
  content: "確認する";
}

.sample-disclosure-toggle::after {
  width: 7px;
  height: 7px;
  border-right: 2px solid #69b8ff;
  border-bottom: 2px solid #69b8ff;
  content: "";
  transform: rotate(45deg) translateY(-2px);
  transition: transform .16s ease;
}

.sample-notification-section[open] .sample-disclosure-toggle::before {
  content: "閉じる";
}

.sample-notification-section[open] .sample-disclosure-toggle::after {
  transform: rotate(225deg) translate(-2px, -2px);
}

.sample-safety-note {
  display: flex;
  gap: 8px 12px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #2d7868;
  border-radius: 9px;
  background: #0b2b2a;
  color: #c9f8e8;
  font-size: .75rem;
  line-height: 1.55;
}

.sample-safety-note strong {
  color: #66e7bd;
}

.sample-section-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  padding: 13px;
  border: 1px solid #355879;
  border-radius: 10px;
  background: #091a2d;
}

.sample-section-actions > div {
  min-width: 0;
}

.sample-section-actions strong {
  color: #f0f7ff;
  font-size: .84rem;
}

.sample-section-actions p {
  margin: 4px 0 0;
  color: #9db8d2;
  font-size: .7rem;
  line-height: 1.5;
}

.sample-section-actions .button {
  flex: 0 0 auto;
}

.sample-send-summary {
  margin: 9px 0 0;
}

.sample-catalog-message {
  margin-top: 13px;
  padding: 13px;
  border: 1px dashed #385675;
  border-radius: 9px;
  color: #abc2d8;
  font-size: .75rem;
}

.sample-catalog-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-color: #86445a;
  color: #ffc0cb;
}

.sample-notification-catalog {
  display: grid;
  gap: 17px;
  margin-top: 17px;
}

.sample-category {
  min-width: 0;
}

.sample-category-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  color: #e9f5ff;
}

.sample-category-heading h3 {
  margin: 0;
  font-size: .92rem;
}

.sample-category-heading span {
  color: #89a9c5;
  font-size: .68rem;
  font-weight: 800;
}

.sample-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.sample-card {
  display: grid;
  grid-template-rows: auto auto minmax(2.9em, 1fr) auto;
  gap: 7px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #2c4b68;
  border-radius: 10px;
  background: #081827;
}

.sample-card[data-result-state="sent"] {
  border-color: #2f8e70;
  box-shadow: inset 3px 0 0 #42d9ae;
}

.sample-card[data-result-state="failed"] {
  border-color: #874258;
  box-shadow: inset 3px 0 0 #fb7185;
}

.sample-card[data-result-state="sending"] {
  border-color: #3f7fb8;
  box-shadow: inset 3px 0 0 #55a7ff;
}

.sample-card-category {
  margin: 0;
  color: #76baff;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .06em;
}

.sample-card h4 {
  margin: 0;
  color: #f0f7ff;
  font-size: .82rem;
  line-height: 1.45;
}

.sample-card-description {
  margin: 0;
  color: #9fb7cf;
  font-size: .7rem;
  line-height: 1.6;
}

.sample-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.sample-card-result {
  min-width: 0;
  margin: 0;
  color: #90aac3;
  font-size: .67rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.sample-card-result[data-state="sent"] {
  color: #66e7bd;
}

.sample-card-result[data-state="failed"] {
  color: #ff9aad;
}

.sample-card-footer .button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 11px;
  font-size: .7rem;
}

.sample-confirm-warning {
  padding: 10px 11px;
  border: 1px solid #7b5c2f;
  border-radius: 8px;
  background: #2b210f;
  color: #ffd98f;
  font-size: .72rem;
  line-height: 1.55;
}

.notification-account-list {
  display: grid;
  gap: 8px;
}

.notification-account-row {
  display: grid;
  grid-template-columns: 8px minmax(180px, 1.2fr) minmax(140px, .8fr) minmax(170px, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #2c4662;
  border-radius: 10px;
  background: #091827;
}

.notification-account-color {
  width: 7px;
  height: 34px;
  border-radius: 999px;
}

.notification-account-name,
.notification-account-meta,
.notification-account-quality {
  min-width: 0;
}

.notification-account-name strong,
.notification-account-name small,
.notification-account-meta span,
.notification-account-quality strong,
.notification-account-quality small {
  display: block;
  overflow-wrap: anywhere;
}

.notification-account-name small,
.notification-account-meta span,
.notification-account-quality small {
  margin-top: 3px;
  color: #8fa7bf;
  font-size: .68rem;
  line-height: 1.5;
}

.notification-anchor-action {
  width: 100%;
  min-height: 34px;
  margin-top: 8px;
  padding: 6px 9px;
  white-space: normal;
  text-align: left;
}

.notification-anchor-status {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: #a9bfd4;
  font-size: .68rem;
  line-height: 1.5;
}

.notification-anchor-status[data-state="success"] {
  color: #79dfb8;
}

.notification-anchor-status[data-state="error"] {
  color: #ffadba;
}

.notification-account-meta strong,
.notification-account-quality strong {
  font-size: .76rem;
}

.notification-account-quality[data-quality="warning"] strong {
  color: #ffd17a;
}

.notification-account-quality[data-quality="blocked"] strong {
  color: #ffadba;
}

.notification-account-row[data-disabled="true"] {
  opacity: .68;
}

.notification-rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.notification-rule-card {
  height: 100%;
}

.rule-heading {
  margin-bottom: 11px;
}

.rule-lead {
  min-height: 3.4em;
  margin: 0 0 14px;
  color: #b0c4d8;
  font-size: .78rem;
  line-height: 1.7;
}

.rule-summary {
  display: grid;
  gap: 0;
  margin: 0;
  border-top: 1px solid #2a435e;
}

.rule-summary div {
  display: grid;
  grid-template-columns: minmax(110px, .75fr) minmax(0, 1.25fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #263e58;
}

.rule-summary dd {
  margin-top: 0;
  text-align: right;
}

.ltv-stage-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 12px;
}

.ltv-stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid #52667e;
  border-radius: 8px;
  background: #101f33;
  color: #cfe0f0;
  font-size: .7rem;
  font-weight: 800;
}

.ltv-stage-chip strong {
  color: #fff;
  font-size: .78rem;
}

.ltv-stage-chip[data-level="warning"] {
  border-color: #8b6b30;
  background: #302611;
}

.ltv-stage-chip[data-level="danger"] {
  border-color: #844255;
  background: #321924;
}

.notification-advanced {
  overflow: clip;
}

.notification-advanced > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  font-weight: 900;
}

.notification-advanced > summary::-webkit-details-marker {
  display: none;
}

.notification-advanced > summary::after {
  flex: 0 0 auto;
  color: #a7c6e1;
  content: "＋";
  font-size: 1.2rem;
}

.notification-advanced[open] > summary::after {
  content: "−";
}

.notification-advanced > summary small {
  margin-left: auto;
  color: #8fa7bf;
  font-size: .7rem;
  font-weight: 600;
}

.advanced-content {
  display: grid;
  gap: 16px;
  padding: 0 18px 18px;
  border-top: 1px solid #29425f;
}

.advanced-content fieldset {
  min-width: 0;
  margin: 16px 0 0;
  padding: 14px;
  border: 1px solid #2b4560;
  border-radius: 10px;
}

.advanced-content legend {
  padding: 0 7px;
  color: #dceeff;
  font-size: .82rem;
  font-weight: 900;
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.compact-advanced-grid {
  margin-top: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  color: #dce9f5;
  font-size: .75rem;
  line-height: 1.45;
}

.check-row input {
  flex: 0 0 auto;
  width: 18px;
  min-height: 18px;
  height: 18px;
}

.ltv-stage-editor {
  display: grid;
  gap: 8px;
}

.ltv-stage-edit-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(100px, .5fr);
  gap: 10px;
}

.notification-history {
  margin-top: 18px;
}

.history-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  margin-bottom: 14px;
}

.notification-history-list {
  display: grid;
  gap: 8px;
}

.notification-history-row {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(150px, 1fr) minmax(160px, 1fr) minmax(120px, .7fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #2c4662;
  border-radius: 10px;
  background: #091827;
}

.notification-history-row > div {
  min-width: 0;
}

.notification-history-row span,
.notification-history-row strong,
.notification-history-row small {
  display: block;
  overflow-wrap: anywhere;
}

.notification-history-row span,
.notification-history-row small {
  color: #8fa7bf;
  font-size: .68rem;
}

.notification-history-row strong {
  margin-top: 3px;
  font-size: .76rem;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.history-actions .button {
  min-height: 36px;
  padding: 6px 9px;
  font-size: .7rem;
}

.history-more {
  display: block;
  margin: 14px auto 0;
}

.notification-save-bar {
  position: fixed;
  z-index: 20;
  right: max(14px, calc((100vw - 1180px) / 2 + 22px));
  bottom: max(14px, env(safe-area-inset-bottom));
  left: max(14px, calc((100vw - 1180px) / 2 + 22px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px;
  border: 1px solid #4a89c4;
  border-radius: 12px;
  background: #102a44f2;
  box-shadow: 0 18px 48px #0009;
  backdrop-filter: blur(10px);
}

.notification-save-bar strong,
.notification-save-bar span {
  display: block;
}

.notification-save-bar span {
  margin-top: 3px;
  color: #acd0ed;
  font-size: .7rem;
}

.save-bar-actions {
  flex: 0 0 auto;
  gap: 8px;
}

.notification-dialog {
  width: min(680px, calc(100vw - 32px));
}

.notification-change-list {
  display: grid;
  gap: 8px;
  max-height: 48dvh;
  overflow-y: auto;
}

.notification-change-row {
  display: grid;
  grid-template-columns: minmax(120px, .7fr) minmax(0, 1.3fr);
  gap: 12px;
  padding: 10px 11px;
  border: 1px solid #2d4661;
  border-radius: 8px;
  background: #091827;
}

.notification-change-row strong {
  font-size: .75rem;
}

.notification-change-values {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 7px;
  color: #a8bfd5;
  font-size: .7rem;
}

.notification-change-values span {
  overflow-wrap: anywhere;
}

.notification-change-values span:last-child {
  color: #eaf6ff;
  font-weight: 850;
}

@media (max-width: 980px) {
  .monitor-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .monitor-facts div:nth-child(3) {
    border-right: 0;
  }

  .monitor-facts div:nth-child(-n+3) {
    border-bottom: 1px solid #263f5a;
  }

  .telegram-layout {
    flex-direction: column;
  }

  .telegram-actions {
    justify-content: flex-start;
  }

  .advanced-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notification-account-row {
    grid-template-columns: 8px minmax(0, 1.2fr) minmax(130px, .8fr) auto;
  }

  .notification-account-quality {
    grid-column: 2 / 4;
  }

  .notification-history-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  }

  .history-actions {
    grid-column: 3;
    grid-row: 1 / 3;
  }
}

@media (max-width: 767px) {
  .notification-shell {
    padding: 10px 12px 128px;
  }

  .notification-topbar {
    min-height: 46px;
    margin-bottom: 12px;
    padding-bottom: 9px;
  }

  .notification-brand {
    display: none;
  }

  .notification-header-actions {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .notification-header-actions .global-page-nav {
    flex: 1 1 auto;
    min-width: 0;
  }

  .notification-header-actions .global-page-nav a {
    flex: 1 1 0;
    min-width: 0;
    min-height: 40px;
    padding-inline: 6px;
    white-space: nowrap;
    font-size: .72rem;
  }

  .notification-header-actions .logout-button {
    flex: 0 0 auto;
    min-height: 40px;
    padding-inline: 9px;
    font-size: .7rem;
  }

  .notification-hero {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .monitor-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .monitor-facts div,
  .monitor-facts div:nth-child(3) {
    border-right: 1px solid #263f5a;
    border-bottom: 1px solid #263f5a;
  }

  .monitor-facts div:nth-child(even) {
    border-right: 0;
  }

  .monitor-facts div:nth-last-child(-n+2) {
    border-bottom: 0;
  }

  .section-heading {
    align-items: flex-start;
  }

  .telegram-facts {
    grid-template-columns: 1fr;
  }

  .telegram-facts div {
    border-right: 0;
    border-bottom: 1px solid #29425f;
  }

  .telegram-facts div:last-child {
    border-bottom: 0;
  }

  .pairing-panel {
    grid-template-columns: 1fr;
  }

  .pairing-panel .button {
    width: 100%;
  }

  .sample-card-grid {
    grid-template-columns: 1fr;
  }

  .notification-account-row {
    grid-template-columns: 8px minmax(0, 1fr) auto;
  }

  .notification-account-meta,
  .notification-account-quality {
    grid-column: 2 / -1;
  }

  .notification-rule-grid {
    grid-template-columns: 1fr;
  }

  .rule-lead {
    min-height: 0;
  }

  .advanced-grid,
  .history-filters {
    grid-template-columns: 1fr;
  }

  .notification-advanced > summary {
    align-items: flex-start;
  }

  .notification-advanced > summary small {
    display: none;
  }

  .notification-history-row {
    grid-template-columns: 1fr 1fr;
  }

  .history-actions {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-content: flex-start;
  }

  .notification-save-bar {
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
  }

  .save-bar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 420px) {
  .notification-header-actions .global-page-nav {
    gap: 4px;
  }

  .notification-header-actions .global-page-nav a {
    padding-inline: 4px;
    font-size: .66rem;
  }

  .notification-header-actions .logout-button {
    padding-inline: 7px;
    font-size: .64rem;
  }

  .notification-hero,
  .notification-section {
    padding: 14px;
    border-radius: 11px;
  }

  .monitor-facts {
    grid-template-columns: 1fr;
  }

  .monitor-facts div,
  .monitor-facts div:nth-child(even),
  .monitor-facts div:nth-last-child(-n+2) {
    border-right: 0;
    border-bottom: 1px solid #263f5a;
  }

  .monitor-facts div:last-child {
    border-bottom: 0;
  }

  .section-heading {
    gap: 10px;
  }

  .sample-disclosure-summary {
    align-items: flex-start;
  }

  .sample-summary-status {
    align-items: flex-end;
    flex-direction: column;
    gap: 7px;
  }

  .sample-section-actions,
  .sample-catalog-error,
  .sample-card-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .sample-section-actions .button,
  .sample-catalog-error .button,
  .sample-card-footer .button {
    width: 100%;
  }

  .sample-category-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .notification-account-row {
    gap: 8px;
    padding: 10px;
  }

  .rule-summary div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .rule-summary dd {
    text-align: left;
  }

  .ltv-stage-edit-row,
  .notification-history-row,
  .notification-change-row,
  .notification-change-values {
    grid-template-columns: 1fr;
  }

  .notification-change-values span:nth-child(2) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .compact-switch input,
  .compact-switch input::before {
    transition: none;
  }
}
