#check-texts {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  background: color-mix(in srgb, var(--accent) 8%, var(--cream));
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--rule));
  border-radius: 13px;
  font: 800 13px/1.2 var(--font);
  padding: 9px 10px;
  min-height: 42px;
  box-shadow: none;
  flex: none;
  touch-action: manipulation;
}
#check-texts[hidden], #texts-count[hidden] { display: none !important; }
#check-texts svg, #texts-dialog button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
#texts-count, .texts-unread {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border-radius: 50px;
  background: #b73062;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.heading:has(#check-texts:not([hidden])) { flex-wrap: nowrap; gap: 5px; }
.heading:has(#check-texts:not([hidden])) #section-caption { display: none; }
.heading:has(#check-texts:not([hidden])) h2 { min-width: 0; flex: 1; }
.texts-ring .texts-bell { animation: texts-ring .8s ease; }
@keyframes texts-ring {
  0%, 100% { transform: rotate(0); }
  20%, 60% { transform: rotate(-20deg); }
  40%, 80% { transform: rotate(20deg); }
}
body.texts-open {
  position: fixed;
  inset-inline: 0;
  overflow: hidden !important;
  overscroll-behavior: none;
}
#texts-dialog {
  --phone-surface: #fff;
  --phone-raised: #fff;
  --phone-fill: #edeef4;
  --phone-bubble: #dfe2ed;
  --phone-border: #d7d9e3;
  --phone-ink: #202236;
  --phone-muted: #54596e;
  --phone-accent: #5039a4;
  --phone-send: #5842a9;
  width: min(422px, calc(100vw - 20px));
  height: min(768px, calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 2px;
  border: 0;
  border-radius: 46px;
  background: linear-gradient(145deg, #948ba7, #383343 47%, #736a85 87%, #2c2936);
  box-shadow: 0 20px 75px #120e2d80;
  overflow: hidden;
  touch-action: pan-y;
  color: var(--phone-ink);
  font-family: system-ui, sans-serif;
}
#texts-dialog::backdrop { background: #161126b8; backdrop-filter: blur(4px); }
.texts-device {
  box-sizing: border-box;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 6px solid #1b1823;
  border-radius: 44px;
  background: var(--phone-surface);
}
.texts-status-bar {
  min-height: 36px;
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  padding: 1px 20px 0;
  background: var(--phone-raised);
  color: var(--phone-ink);
  font-size: 11px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}
.texts-camera {
  width: 70px;
  height: 17px;
  border-radius: 99px;
  background: #1b1823;
}
.texts-status-icons { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.texts-signal {
  width: 13px;
  height: 9px;
  background: currentColor;
  clip-path: polygon(0 100%, 0 67%, 20% 67%, 20% 100%, 30% 100%, 30% 46%, 49% 46%, 49% 100%, 57% 100%, 57% 24%, 76% 24%, 76% 100%, 84% 100%, 84% 0, 100% 0, 100% 100%);
}
.texts-battery {
  position: relative;
  width: 16px;
  height: 9px;
  border: 1px solid currentColor;
  border-radius: 3px;
}
.texts-battery::before, .texts-battery::after { content: ""; position: absolute; background: currentColor; }
.texts-battery::before { inset: 1px 3px 1px 1px; border-radius: 1px; }
.texts-battery::after { width: 1px; height: 3px; inset: 2px -3px auto auto; }
#texts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 1px 10px 8px;
  border-bottom: 1px solid var(--phone-border);
  background: var(--phone-raised);
  flex: none;
}
.texts-header-title { display: flex; align-items: center; justify-content: center; gap: 8px; flex: 1; min-width: 0; }
.texts-header-title div { min-width: 0; }
.texts-header-title strong, .texts-header-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.texts-header-title strong { font-size: 16px; font-weight: 800; line-height: 1.25; }
.texts-header-title small { font-size: 11px; color: var(--phone-muted); }
#texts-header[data-view="inbox"] .texts-header-title { justify-content: flex-start; padding-inline-start: 5px; }
#texts-header[data-view="inbox"] .texts-header-title strong { font-size: 24px; letter-spacing: -.04em; }
#texts-dialog button {
  font-family: inherit;
  box-shadow: none;
  touch-action: manipulation;
  min-width: 0;
}
#texts-dialog button:focus-visible, .texts-typed-form textarea:focus-visible {
  outline: 2px solid var(--phone-accent);
  outline-offset: 2px;
}
#texts-dialog button:disabled { opacity: .5; }
#texts-dialog .texts-icon-btn {
  flex: none;
  width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--phone-accent);
  background: var(--phone-fill);
}
#texts-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding: 9px 13px 14px;
}
.texts-inbox-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding-bottom: 8px; }
.texts-inbox-filters { display: flex; gap: 3px; flex: 1; min-width: 0; padding: 2px; border-radius: 15px; background: var(--phone-fill); }
#texts-dialog .texts-filter {
  min-height: 40px;
  flex: 1;
  padding: 5px 4px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--phone-muted);
  font-size: 11px;
  font-weight: 720;
}
#texts-dialog .texts-filter.active { background: var(--phone-raised); color: var(--phone-ink); border-color: var(--phone-border); }
#texts-dialog .texts-compose, #texts-dialog .texts-secondary, #texts-dialog .texts-jump {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid var(--phone-border);
  border-radius: 14px;
  background: var(--phone-raised);
  color: var(--phone-accent);
  font-size: 12px;
  font-weight: 780;
}
#texts-dialog .texts-secondary { width: 100%; margin-top: 10px; }
#texts-dialog .texts-contact {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 62px;
  padding: 8px 6px;
  border: 0;
  border-bottom: 1px solid var(--phone-border);
  border-radius: 0;
  background: transparent;
  color: var(--phone-ink);
  text-align: left;
}
#texts-dialog .texts-contact-unread { background: color-mix(in srgb, var(--phone-accent) 6%, var(--phone-surface)); }
.texts-avatar { display: grid; place-items: center; width: 42px; height: 42px; object-fit: cover; flex: none; border-radius: 50%; }
.texts-avatar-unknown { background: var(--phone-fill); color: var(--phone-accent); font-size: 20px; font-weight: 800; }
.texts-header-title .texts-avatar { width: 35px; height: 35px; }
.texts-contact-copy { display: grid; gap: 3px; flex: 1; min-width: 0; }
.texts-contact-copy strong, .texts-contact-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.texts-contact-copy strong { font-size: 14px; font-weight: 780; }
.texts-contact-copy small, .texts-inbox-meta { font-size: 12px; color: var(--phone-muted); }
.texts-inbox-meta { display: grid; justify-items: end; gap: 4px; flex: none; font-size: 10px; }
.texts-empty { padding: 38px 13px; text-align: center; color: var(--phone-muted); }
.texts-empty > span { font-size: 32px; }
.texts-empty h3 { margin: 8px 0; font-size: 17px; color: var(--phone-ink); }
.texts-empty p, .texts-hint { font-size: 13px; line-height: 1.5; color: var(--phone-muted); }
.texts-hint { margin: 3px 0 10px; }
.texts-conversation { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.texts-date { align-self: center; margin: 6px 0 2px; color: var(--phone-muted); font-size: 11px; font-weight: 740; }
.texts-message { display: grid; gap: 4px; align-self: flex-start; justify-items: start; max-width: 90%; min-width: 0; }
.texts-message.texts-out { align-self: flex-end; justify-items: end; }
.texts-bubble {
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 18px 18px 18px 6px;
  background: var(--phone-bubble);
  box-shadow: inset 0 0 0 1px #c8ccdc;
  color: var(--phone-ink);
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.texts-out .texts-bubble { border-radius: 18px 18px 6px 18px; background: var(--phone-send); color: #fff; box-shadow: none; }
.texts-delivery, .texts-story-label { padding-inline: 3px; color: var(--phone-muted); font-size: 11px; }
.texts-story-label { color: var(--phone-accent); font-weight: 750; }
.texts-reply-dot { padding: 3px 6px; border-radius: 10px; background: var(--phone-fill); color: var(--phone-accent); font-weight: 740; }
.texts-replies { display: grid; gap: 5px; width: 100%; }
#texts-dialog .texts-reply, #texts-dialog .texts-compose-option {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--phone-border);
  border-radius: 12px;
  background: var(--phone-raised);
  color: var(--phone-accent);
  font-size: 13px;
  font-weight: 710;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
#texts-dialog .texts-compose-option { margin: 5px 0; }
.texts-compose-option small { color: var(--phone-muted); font-size: 12px; font-weight: 500; }
.texts-compose-group { margin: 6px 0; padding: 0 6px; border: 1px solid var(--phone-border); border-radius: 14px; }
.texts-compose-group summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 8px 5px; color: var(--phone-ink); font-size: 14px; font-weight: 760; cursor: pointer; list-style: none; }
.texts-compose-group summary::-webkit-details-marker { display: none; }
.texts-compose-group summary span { color: var(--phone-accent); }
.texts-compose-group[open] summary span { transform: rotate(180deg); }
#texts-footer { display: grid; flex: none; gap: 6px; min-width: 0; padding: 8px 11px 1px; border-top: 1px solid var(--phone-border); background: var(--phone-raised); }
#texts-footer[hidden] { display: none; }
.texts-thread-actions { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
#texts-footer .texts-secondary, #texts-footer .texts-jump { flex: 1; width: auto; margin: 0; }
.texts-typed-form { display: grid; gap: 5px; min-width: 0; margin: 3px 0 11px; }
#texts-footer .texts-typed-form { margin: 0; }
.texts-typed-form label { padding-inline: 4px; color: var(--phone-ink); font-size: 12px; font-weight: 740; }
.texts-typed-row { display: flex; align-items: flex-end; gap: 6px; }
.texts-typed-form textarea {
  box-sizing: border-box;
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: 116px;
  padding: 8px 12px;
  border: 1px solid var(--phone-border);
  border-radius: 21px;
  background: var(--phone-surface);
  color: var(--phone-ink);
  line-height: 1.35;
  font-family: inherit;
  font-size: 16px;
  resize: vertical;
}
.texts-typed-form small { padding-inline: 4px; color: var(--phone-muted); font-size: 11px; line-height: 1.35; }
.texts-typed-form a { color: var(--phone-accent); }
#texts-dialog .texts-typed-form .texts-compose { flex: none; min-width: 58px; border-color: transparent; border-radius: 99px; background: var(--phone-send); color: white; }
.texts-device-bottom { flex: none; display: grid; place-items: center; height: 17px; background: var(--phone-raised); }
.texts-home-indicator { width: 86px; height: 4px; border-radius: 99px; background: var(--phone-ink); opacity: .7; }
@media (max-width: 400px) {
  #check-texts { font-size: 11px; padding: 7px; gap: 4px; }
  #check-texts svg { width: 16px; height: 16px; }
  .heading:has(#check-texts:not([hidden])) h2 { font-size: clamp(23px, 6.5vw, 30px); }
  #texts-dialog { width: calc(100vw - 10px); border-radius: 34px; }
  .texts-device { border-width: 4px; border-radius: 32px; }
  #texts-body { padding-inline: 10px; }
  .texts-message { max-width: 94%; }
}
@media (max-height: 620px) {
  .texts-status-bar { min-height: 29px; }
  #texts-header { padding-bottom: 4px; }
  .texts-device-bottom { height: 13px; }
}
@media (prefers-reduced-motion: reduce) { .texts-ring .texts-bell { animation: none; } }

.texts-plan { padding: 5px 2px; }
.texts-plan h3 { margin: 4px 0 8px; font-size: 19px; color: var(--phone-ink); }
.texts-plan p { margin: 0 0 12px; color: var(--phone-muted); font-size: 14px; line-height: 1.5; }
#texts-dialog .texts-upcoming {
  width: 100%;
  min-height: 44px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--phone-border);
  border-radius: 13px;
  background: var(--phone-fill);
  color: var(--phone-accent);
  font-size: 13px;
  font-weight: 780;
  text-align: start;
}
