/* Paper and ink, one vermilion accent. Logical properties throughout, so the
   Hebrew layout is the same stylesheet mirrored rather than a second one. */

:root {
  --paper: #f3efe6;
  --paper-2: #ebe5d8;
  --card: #fffcf6;
  --ink: #1c1b17;
  --ink-2: #45423a;
  --muted: #7a7468;
  --line: #ddd5c5;
  --line-soft: #e8e1d3;
  --accent: #d9481c;
  --accent-hover: #c23e15;
  --accent-ink: #fffaf2;
  --accent-soft: rgba(217, 72, 28, 0.1);
  --ok: #2e7a4b;
  --ok-soft: rgba(46, 122, 75, 0.12);
  --danger: #b3261e;
  --shadow-sm: 0 1px 0 rgba(28, 27, 23, 0.04), 0 2px 6px -3px rgba(28, 27, 23, 0.12);
  --shadow: 0 1px 0 rgba(28, 27, 23, 0.04), 0 14px 32px -18px rgba(28, 27, 23, 0.32);
  --radius: 16px;
  --radius-sm: 10px;
  --font-display: "Frank Ruhl Libre", "Times New Roman", serif;
  --font-text: "IBM Plex Sans Hebrew", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
  --bar-h: 64px;
  --tabbar-h: 68px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14130f;
    --paper-2: #1b1915;
    --card: #1f1d18;
    --ink: #efe9dd;
    --ink-2: #cfc8b9;
    --muted: #979083;
    --line: #322e27;
    --line-soft: #29261f;
    --accent: #ff6b3d;
    --accent-hover: #ff8259;
    --accent-ink: #1a0b05;
    --accent-soft: rgba(255, 107, 61, 0.14);
    --ok: #6cc58f;
    --ok-soft: rgba(108, 197, 143, 0.14);
    --danger: #ff8a80;
    --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font: 400 16px/1.55 var(--font-text);
  background-color: var(--paper);
  /* A whisper of paper grain, so the page is a surface and not a void. */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.i {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- bar ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.bar.scrolled {
  border-bottom-color: var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand img {
  border-radius: 8px;
}

.wordmark {
  font: 700 22px/1 var(--font-display);
  letter-spacing: -0.01em;
}

.bar-end {
  display: flex;
  align-items: center;
  gap: 12px;
}

.support {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.support:hover {
  color: var(--ink);
  background: var(--paper-2);
}

.support .i {
  width: 18px;
  height: 18px;
}

/* ---------- segmented control ---------- */

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
}

.seg button {
  border: 0;
  background: none;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.seg button[aria-pressed="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.seg.wide {
  display: flex;
}

.seg.wide button {
  flex: 1;
  padding: 8px 12px;
  font-size: 15px;
}

/* ---------- tabs: a bottom bar on phones, inline in the bar above ---------- */

.tabs {
  display: flex;
  gap: 4px;
}

.tabs button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.tabs button:hover {
  color: var(--ink);
}

.tabs button.active {
  color: var(--ink);
  background: var(--paper-2);
}

.count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 11px/18px var(--font-text);
  text-align: center;
}

@media (max-width: 719px) {
  body.app {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  }

  .tabs {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 20;
    justify-content: space-around;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 6px 8px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--paper) 90%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--line-soft);
  }

  .tabs button {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 6px 4px;
    font-size: 12px;
    border-radius: 14px;
  }

  .tabs button.active {
    background: none;
    color: var(--accent);
  }

  .tabs .count {
    position: absolute;
    top: 2px;
    inset-inline-start: calc(50% + 6px);
  }

  body.app #lang-switch {
    display: none;
  }

  /* backdrop-filter makes the bar the containing block of every fixed
     descendant, which would pin the tab bar to the top of the page. */
  body.app .bar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--paper);
  }
}

/* ---------- layout ---------- */

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 16px 48px;
}

.view {
  animation: rise 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.title {
  font: 700 30px/1.15 var(--font-display);
  letter-spacing: -0.01em;
  margin: 24px 0 6px;
}

.title.minor {
  font-size: 22px;
  margin-top: 44px;
}

.lede {
  color: var(--muted);
  margin: 0 0 18px;
  max-width: 60ch;
}

.muted {
  color: var(--muted);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.row.spread {
  justify-content: space-between;
  align-items: flex-end;
}

.row.end {
  justify-content: flex-end;
}

.stack {
  display: grid;
  gap: 12px;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--muted);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.quiet {
  background: none;
  border-color: transparent;
  color: var(--ink-2);
}

.btn.quiet:hover {
  background: var(--paper-2);
}

.btn.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  background: none;
}

.btn.small {
  min-height: 34px;
  padding: 0 14px;
  font-size: 14px;
}

.btn.large {
  min-height: 52px;
  padding: 0 24px;
  font-size: 17px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--paper-2);
  color: var(--ink);
}

/* ---------- banners ---------- */

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 720px;
  margin: 8px auto 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
}

.banner strong {
  display: block;
  font-size: 15px;
}

.banner span {
  color: var(--muted);
}

@media (max-width: 752px) {
  .banner {
    margin-inline: 16px;
  }
}

/* ---------- landing ---------- */

.landing {
  display: grid;
  gap: 40px;
  padding: 28px 0 24px;
}

.landing > * {
  min-width: 0;
}

@media (min-width: 900px) {
  main:has(> .landing:not([hidden])) {
    max-width: 1080px;
  }

  .landing {
    grid-template-columns: 1.1fr 1fr;
    align-items: center;
    min-height: calc(100dvh - var(--bar-h) - 40px);
    padding-top: 0;
  }
}

.kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

:lang(he) .kicker {
  letter-spacing: 0;
}

.landing h1 {
  font: 700 clamp(36px, 7vw, 58px) / 1.05 var(--font-display);
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  text-wrap: balance;
}

:lang(he) .landing h1 {
  letter-spacing: 0;
  line-height: 1.12;
}

.landing .lede {
  font-size: 18px;
  color: var(--ink-2);
  margin-bottom: 22px;
}

.points {
  list-style: none;
  padding: 0;
  margin: 0 0 30px;
  display: grid;
  gap: 10px;
}

.points li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--ink-2);
}

.points .i {
  color: var(--accent);
  margin-top: 2px;
}

.cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
  width: 100%;
  max-width: 560px;
}

.btn.choice {
  min-height: 56px;
  padding: 8px 20px;
  white-space: normal;
  text-align: center;
  font-size: 16px;
  background: var(--card);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.btn.choice:hover {
  border-color: var(--ink-2);
}

.btn.choice .i {
  width: 22px;
  height: 22px;
  color: var(--ink-2);
}

.cta .g {
  width: 22px;
  height: 22px;
}

.fine {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* The art is the product: three real-looking messages, fanned like slips. */
.landing-art {
  position: relative;
  height: 360px;
  max-width: 460px;
  width: 100%;
  justify-self: center;
}

.slip {
  position: absolute;
  inset-inline: 0;
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow);
  font-size: 15px;
  animation: deal 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.slip p {
  margin: 2px 0 0;
  color: var(--ink-2);
  line-height: 1.5;
}

.slip-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 13px;
  color: var(--muted);
}

.slip-head b {
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
}

.s1 {
  top: 16px;
  --r: -2.5deg;
  transform: rotate(var(--r));
  animation-delay: 0.35s;
  z-index: 3;
}

.s2 {
  top: 142px;
  inset-inline-start: 28px;
  inset-inline-end: -8px;
  --r: 1.8deg;
  transform: rotate(var(--r));
  animation-delay: 0.2s;
  z-index: 2;
}

.s3 {
  top: 252px;
  inset-inline-start: 6px;
  inset-inline-end: 34px;
  --r: -1deg;
  transform: rotate(var(--r));
  animation-delay: 0.05s;
  z-index: 1;
}

.s1::after {
  content: "";
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--accent);
}

@keyframes deal {
  from {
    opacity: 0;
    transform: translateY(28px) rotate(0deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(var(--r));
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------- avatars ---------- */

.avatar {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--paper-2);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.avatar.mono {
  display: grid;
  place-items: center;
  font: 700 19px/1 var(--font-display);
  color: oklch(0.42 0.1 var(--hue));
  background: oklch(0.93 0.04 var(--hue));
}

@media (prefers-color-scheme: dark) {
  .avatar.mono {
    color: oklch(0.86 0.08 var(--hue));
    background: oklch(0.32 0.05 var(--hue));
  }
}

.avatar.big {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 24px;
}

/* ---------- inbox ---------- */

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 16px 0 12px;
}

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  color: var(--muted);
}

.search:focus-within {
  border-color: var(--muted);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ink);
}

.search input::-webkit-search-cancel-button {
  filter: grayscale(1);
}

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px 8px;
  padding: 2px 16px 6px;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 34px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: var(--card);
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
}

.chip img,
.chip .mono {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 11px;
}

.chip[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.day {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 4px;
  font: 700 16px/1.2 var(--font-display);
  color: var(--muted);
}

.day::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.feed {
  display: grid;
  gap: 10px;
}

.msg {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 16px 16px 12px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
  animation: rise 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 30ms);
  scroll-margin-top: calc(var(--bar-h) + 48px);
}

.msg.unread::before {
  content: "";
  position: absolute;
  top: 22px;
  inset-inline-start: -5px;
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--paper);
}

.msg.flash {
  animation: flash 1.6s ease-out;
}

@keyframes flash {
  0%,
  30% {
    box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
    border-color: var(--accent);
  }
}

.msg-main {
  flex: 1;
  min-width: 0;
}

.msg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.msg-source {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.msg.unread .msg-source::after {
  content: none;
}

.msg-head time {
  margin-inline-start: auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.msg-title {
  margin: 4px 0 0;
  font: 600 16px/1.4 var(--font-text);
}

.msg-body {
  margin-top: 4px;
  color: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.6;
  unicode-bidi: plaintext;
  text-align: start;
  cursor: pointer;
}

.msg-body:lang(he) {
  font-size: 17px;
}

.msg-body.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.msg-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin: 8px -8px 0;
}

.msg-actions .spacer {
  flex: 1;
}

.act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.act .i {
  width: 18px;
  height: 18px;
}

.act:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.act.more {
  color: var(--accent);
}

.partial-note {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

.empty {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 6px;
  padding: 64px 16px;
}

.empty h3 {
  margin: 12px 0 0;
  font: 700 24px/1.2 var(--font-display);
}

.empty p {
  margin: 0 0 14px;
  color: var(--muted);
}

.empty-art {
  position: relative;
  width: 120px;
  height: 84px;
}

.empty-art span {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
}

.empty-art span:first-child {
  transform: rotate(-8deg) translate(-8px, -6px);
  opacity: 0.6;
}

.empty-art span:last-child::before,
.empty-art span:last-child::after {
  content: "";
  position: absolute;
  inset-inline-start: 18px;
  height: 8px;
  border-radius: 8px;
  background: var(--line);
}

.empty-art span:last-child::before {
  top: 28px;
  width: 60px;
}

.empty-art span:last-child::after {
  top: 46px;
  width: 38px;
}

/* ---------- panels, cards, lists ---------- */

.panel,
.card {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-sm);
}

.panel {
  margin-top: 14px;
}

.panel h3 {
  margin: 0 0 10px;
  font: 700 19px/1.3 var(--font-display);
}

.panel > p {
  margin: 0 0 12px;
}

.list {
  display: grid;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}

.list-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.list-row .grow {
  flex: 1;
  min-width: 0;
}

.list-row .sub {
  font-size: 13px;
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--paper-2);
  color: var(--muted);
}

.tag.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.tag.accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.source-card {
  display: grid;
  gap: 14px;
}

.source-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.source-top .grow {
  flex: 1;
  min-width: 0;
}

.source-top h3 {
  margin: 2px 0 2px;
  font: 700 21px/1.2 var(--font-display);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.source-top p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.subs {
  display: grid;
  gap: 0;
  padding: 4px 14px;
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.subs .list-row:first-child {
  padding-top: 10px;
}

.account-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.account-head h3 {
  margin: 0;
}

.account-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.panel.warn {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line-soft));
  background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--card);
}

.diag summary {
  cursor: pointer;
  font: 700 17px/1.3 var(--font-display);
}

.diag dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 14px 0 0;
  font-size: 14px;
}

.diag dt {
  color: var(--muted);
}

.diag dd {
  margin: 0;
  overflow-wrap: anywhere;
}

section > .row.end {
  margin-top: 24px;
}

/* ---------- forms ---------- */

/* :where keeps these defaults at zero specificity, so any component can
   restyle its own inputs without fighting them. */
:where(input:not([type="checkbox"]):not([type="color"]):not([type="file"])),
:where(textarea) {
  width: 100%;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--card);
  outline: 0;
}

:where(input, textarea):focus {
  border-color: var(--muted);
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.inline-form input {
  flex: 1;
}

.field {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--ink);
}

.reveal {
  margin: 0 0 16px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px dashed var(--accent);
  background: var(--accent-soft);
}

.reveal p {
  margin: 0 0 10px;
}

pre,
code,
.code {
  font-family: var(--font-mono);
}

pre {
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--line-soft);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  direction: ltr;
  text-align: left;
}

/* ---------- admin ---------- */

.method {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  border: 1px solid var(--line-soft);
}

.method-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.notif-preview {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--paper-2);
  font-size: 14px;
}

.notif-preview b {
  display: block;
}

.notif-preview span {
  color: var(--muted);
}

/* ---------- dialogs ---------- */

dialog {
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(20, 19, 15, 0.45);
  backdrop-filter: blur(2px);
}

.dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 22px;
  border: 0;
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.dialog h2 {
  margin: 0 0 8px;
  font: 700 22px/1.25 var(--font-display);
}

.dialog p {
  margin: 0 0 18px;
  color: var(--ink-2);
}

.sheet {
  width: min(520px, 100vw);
  max-width: 100vw;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0 0 max(20px, env(safe-area-inset-bottom));
  border: 0;
  border-radius: 26px 26px 0 0;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: auto;
}

.sheet[open] {
  animation: sheet-up 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (min-width: 720px) {
  .sheet {
    margin: auto;
    border-radius: 26px;
    padding-bottom: 20px;
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

.sheet-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 12px;
  background: var(--card);
}

.sheet-head h2 {
  flex: 1;
  margin: 0;
  font: 700 22px/1.2 var(--font-display);
}

#sheet-body {
  padding: 4px 20px 0;
}

.step-label {
  margin: 6px 0 10px;
  color: var(--ink-2);
}

.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px;
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  direction: ltr;
}

.code-box .code {
  font-size: clamp(26px, 8vw, 34px);
  font-weight: 500;
  letter-spacing: 0.08em;
  user-select: all;
}

.methods {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.methods .btn {
  justify-content: space-between;
  width: 100%;
  min-height: 50px;
  padding: 0 20px;
}

.methods .btn .i {
  transform: scaleX(var(--flip, 1));
}

:dir(rtl) .methods .btn .i {
  --flip: -1;
}

.literal {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 14px;
  direction: ltr;
  justify-content: space-between;
}

.status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--paper-2);
  font-weight: 500;
}

.status small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pulse {
  position: relative;
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 99px;
  background: var(--accent);
}

.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent);
  animation: ping 1.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  75%,
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

.success {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
  padding: 18px 0 8px;
}

.success h3 {
  margin: 8px 0 0;
  font: 700 24px/1.2 var(--font-display);
}

.success p {
  margin: 0 0 12px;
  color: var(--muted);
  max-width: 34ch;
}

.tick {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.tick .i {
  width: 34px;
  height: 34px;
  stroke-width: 2.2;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: draw 0.4s 0.2s ease-out forwards;
}

@keyframes pop {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  z-index: 50;
  inset-inline: 16px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 12px 12px 18px;
  padding-inline: 18px 12px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow);
  font-size: 15px;
  animation: rise 0.25s ease-out both;
}

body.app .toast {
  bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom));
}

@media (min-width: 720px) {
  body.app .toast {
    bottom: 24px;
  }
}

.toast button {
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }

  .tick .i {
    stroke-dashoffset: 0;
  }
}

h4.field {
  margin: 8px 0 0;
}

/* ---------- notification trouble ---------- */

.help {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-inline-start: 3px solid var(--accent);
}

.help h3 {
  margin: 0 0 4px;
  font: 700 18px/1.3 var(--font-display);
}

.help p {
  margin: 0 0 8px;
}

.help ol {
  margin: 0 0 12px;
  padding-inline-start: 22px;
  display: grid;
  gap: 4px;
}

.help .hint {
  margin-bottom: 12px;
}

.notify-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 8px 8px 8px 14px;
  padding-inline: 14px 8px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 14px;
}

.notify-banner .i {
  color: var(--accent);
}

.notify-banner .grow {
  flex: 1;
}

/* Brand, support and the language switch share one row on a phone. */
@media (max-width: 480px) {
  .support span {
    display: none;
  }

  .support {
    padding: 8px;
  }
}
