/* Web client (/app). Builds on css/nabih.css — every colour, radius and
   duration comes from its tokens. */

html,
body {
  height: 100%;
}
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ================= Sign-in ================= */
.auth {
  min-height: 100%;
  display: grid;
}
@media (min-width: 960px) {
  .auth {
    grid-template-columns: 1fr 1fr;
  }
}
.auth__art {
  display: none;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #0a0f1e;
  color: #eef2ff;
  padding: 48px;
  --aurora-1: #3a5bff;
  --aurora-2: #c9772f;
}
@media (min-width: 960px) {
  .auth__art {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
}
.auth__art .orb {
  --size: 150px;
  background: radial-gradient(
    circle at 35% 30%,
    #fff 0 6%,
    #b9d3ff 14%,
    #4d6bff 48%,
    #1b2150 75%
  );
  animation: n-breathe 4.2s ease-in-out infinite;
}
.auth__art .orb::after {
  display: none;
}
.auth__art h2 {
  font-size: clamp(1.8rem, 1rem + 2vw, 2.6rem);
  font-weight: 600;
  max-width: 14em;
  margin-block: 36px 14px;
}
.auth__art p {
  color: #9aa5c8;
  max-width: 30em;
}
.auth__quote {
  display: grid;
  gap: 10px;
  max-width: 420px;
}
.auth__quote .q {
  background: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: 18px;
  padding: 10px 14px;
  font-size: 0.92rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.auth__quote .q--me {
  justify-self: start;
  background: #8fa8ff;
  color: #0a0f1e;
  border: 0;
}
.auth__quote .q--bot {
  justify-self: end;
}
.auth__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.3rem;
  color: inherit;
  text-decoration: none;
}
.auth__brand .orb {
  --size: 28px;
}
.auth__main {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 16px
    calc(24px + env(safe-area-inset-bottom, 0px));
}
.auth__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 440px);
  margin-inline: auto;
}
@media (min-width: 960px) {
  .auth__bar .auth__brand {
    visibility: hidden;
  }
}
.auth__panel {
  width: min(100%, 440px);
  margin: auto;
  padding-block: 32px;
}
.auth__panel h1 {
  font-size: 1.75rem;
  font-weight: 600;
}
.auth__panel .sub {
  color: var(--muted);
  margin-block: 6px 28px;
}
.form {
  display: grid;
  gap: 16px;
}
.form .btn--block {
  margin-block-start: 4px;
}
.form-error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.875rem;
  animation: n-rise var(--t) var(--ease);
}
.form-error:empty {
  display: none;
}
.form-note {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 0.875rem;
}
.form-note:empty {
  display: none;
}
.alt {
  text-align: center;
  font-size: 0.925rem;
  color: var(--muted);
  margin-block-start: 22px;
}
.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.link:hover {
  text-decoration: underline;
}
.legal {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-block-start: 18px;
}
.legal a {
  color: var(--ink);
}
.auth__foot {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 0.8rem;
}
.auth__foot a {
  color: var(--muted);
  text-decoration: none;
}
.auth__foot a:hover {
  color: var(--accent);
}
.pw {
  position: relative;
}
.pw input {
  padding-inline-end: 46px !important;
}
.pw__toggle {
  position: absolute;
  inset-inline-end: 6px;
  inset-block: 6px;
  width: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.pw__toggle:hover {
  color: var(--ink);
  background: var(--surface-2);
}

/* Choice cards (field, gender) */
.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: start;
  transition:
    border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    background-color var(--t-fast) var(--ease);
}
.choice:hover {
  border-color: var(--faint);
}
.choice[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.choice__ic {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--accent);
  flex: none;
}
.choice[aria-checked="true"] .choice__ic {
  background: var(--accent);
  color: var(--accent-ink);
}
.choice b {
  display: block;
  font-weight: 500;
  line-height: 1.3;
}
.choice small {
  color: var(--muted);
  font-size: 0.78rem;
}
.choices--compact .choice {
  justify-content: center;
  padding: 11px;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 520px) {
  .grid2 {
    grid-template-columns: 1fr;
  }
}

/* OTP */
.otp {
  text-align: center;
  letter-spacing: 0.5em;
  font-size: 1.5rem !important;
  font-weight: 500;
  direction: ltr;
  padding-inline-start: calc(14px + 0.5em) !important;
}
.code-hint {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: 0.9rem;
}
.code-hint .icon {
  color: var(--accent);
  margin-block-start: 2px;
}
.code-hint.is-manual {
  background: var(--warn-soft);
}
.code-hint.is-manual .icon {
  color: var(--warn);
}
.resend {
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ================= App shell ================= */
.app {
  display: flex;
  height: 100%;
}
.side {
  width: 248px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 14px;
  background: var(--bg-2);
  border-inline-end: 1px solid var(--line);
}
.side__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.25rem;
  padding: 6px 10px 18px;
}
.side__brand .orb {
  --size: 28px;
}
.nav {
  display: grid;
  gap: 2px;
  flex: 1;
  align-content: start;
}
.nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: start;
  transition:
    background-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}
.nav button:hover {
  background: var(--surface-2);
  color: var(--ink);
}
/* A count waiting for the user (an invitation to an office). */
.nav__badge {
  margin-inline-start: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.75rem;
  line-height: 18px;
  text-align: center;
}
.nav button[aria-current="page"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.side__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  flex: none;
}
.side__user .who {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}
.side__user b {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side__user small {
  color: var(--muted);
  font-size: 0.75rem;
}

main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: env(safe-area-inset-top, 0px) 24px 0;
  border-block-end: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.head__title {
  flex: 1;
  font-weight: 600;
  font-size: 1.1rem;
  min-width: 0;
}
.menu-btn {
  display: none;
  position: relative;
}
/* Something waits inside the menu (an invitation) — the menu is closed on a phone. */
.menu-btn__dot {
  position: absolute;
  inset-block-start: 6px;
  inset-inline-end: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}
.body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
}
.body__in {
  max-width: 860px;
  margin-inline: auto;
}
.scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t) var(--ease);
}
.scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Phone: sidebar becomes a drawer; bottom tabs take over navigation. */
@media (max-width: 760px) {
  .menu-btn {
    display: inline-flex;
  }
  .head {
    padding-inline: 12px;
    min-height: 58px;
  }
  .body {
    padding: 16px 16px calc(84px + env(safe-area-inset-bottom, 0px));
  }
  .side {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 40;
    width: min(290px, 84vw);
    transform: translateX(105%);
    transition: transform var(--t-slow) var(--ease);
    box-shadow: var(--shadow-lg);
    padding-block-start: calc(18px + env(safe-area-inset-top, 0px));
  }
  .side.is-open {
    transform: none;
  }
}
.tabs {
  display: none;
}
@media (max-width: 760px) {
  .tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: 30;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-block-start: 1px solid var(--line);
  }
  .tabs button {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 6px 4px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
  }
  .tabs button[aria-current="page"] {
    color: var(--accent);
  }
  .tabs .icon {
    width: 22px;
    height: 22px;
  }
  /* The chat has its own composer at the bottom; tabs would cover it. */
  .is-chat .tabs {
    display: none;
  }
  .is-chat .composer {
    padding-block-end: calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

/* ================= Banners ================= */
.gate {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 24px;
  font-size: 0.9rem;
  background: var(--warn-soft);
  color: var(--ink);
  border-block-end: 1px solid var(--line);
}
.gate .icon {
  color: var(--warn);
  margin-block-start: 2px;
}
.gate b {
  color: var(--warn);
  font-weight: 600;
}
.gate.is-danger {
  background: var(--danger-soft);
}
.gate.is-danger .icon,
.gate.is-danger b {
  color: var(--danger);
}
@media (max-width: 760px) {
  .gate {
    padding-inline: 16px;
  }
}

/* ================= Lists ================= */
.seg {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-block-end: 20px;
}
.seg button {
  padding: 7px 18px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition:
    background-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}
.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.group {
  display: grid;
  gap: 8px;
  margin-block-end: 24px;
}
.group__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.group__label .count {
  font-weight: 500;
  color: var(--faint);
}
.group__label.is-late {
  color: var(--danger);
}
.item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-align: start;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  animation: n-rise var(--t-slow) var(--ease) both;
  animation-delay: calc(var(--i, 0) * 30ms);
  transition:
    border-color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease),
    box-shadow var(--t) var(--ease);
}
.item:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}
.item:active {
  transform: scale(0.995);
}
.item.is-static {
  cursor: default;
}
.item__ic {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex: none;
  background: var(--accent-soft);
  color: var(--accent);
}
.item__ic.is-late {
  background: var(--danger-soft);
  color: var(--danger);
}
.item__ic.is-done {
  background: var(--ok-soft);
  color: var(--ok);
}
.item__tx {
  flex: 1;
  min-width: 0;
}
.item__t {
  font-weight: 500;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.item__s {
  font-size: 0.85rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-block-start: 6px;
}
.item__when {
  flex: none;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: end;
  max-width: 40%;
}
/* Undo sits under the time, so the title keeps its width on a phone. */
.item__when--undo {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 6px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-block-end: 24px;
}
.stat {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.stat b {
  display: block;
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat span {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Empty / loading / error states */
.state {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
  padding: 64px 20px;
  color: var(--muted);
}
.state__ic {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--accent);
  margin-block-end: 6px;
}
.state__ic .icon {
  width: 28px;
  height: 28px;
}
.state b {
  color: var(--ink);
  font-weight: 500;
  font-size: 1.05rem;
}
.state p {
  max-width: 30em;
  font-size: 0.925rem;
}
.state .btn {
  margin-block-start: 8px;
}
.sk-list {
  display: grid;
  gap: 8px;
}
.sk-list .skeleton {
  height: 70px;
  border-radius: var(--radius);
}

/* ================= Chat ================= */
.chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  scroll-behavior: smooth;
}
.msgs__in {
  max-width: 780px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
@media (max-width: 760px) {
  .msgs {
    padding: 16px;
  }
}
.msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 88%;
  animation: n-rise var(--t-slow) var(--ease) both;
}
.msg--u {
  align-self: flex-start;
}
.msg--n {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg .orb {
  --size: 28px;
  margin-block-end: 2px;
}
.bub {
  padding: 11px 16px;
  border-radius: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
}
.msg--u .bub {
  background: var(--accent);
  color: var(--accent-ink);
  border-end-start-radius: 6px;
}
.msg--n .bub {
  background: var(--surface);
  border: 1px solid var(--line);
  border-end-end-radius: 6px;
  box-shadow: var(--shadow-sm);
}
.msg--err .bub {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}
.typing {
  display: inline-flex;
  gap: 4px;
  padding: 15px 16px;
}
.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: dot 1s infinite;
}
.typing i:nth-child(2) {
  animation-delay: 0.15s;
}
.typing i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes dot {
  50% {
    transform: translateY(-4px);
    opacity: 0.4;
  }
}
.confirm {
  align-self: flex-end;
  width: min(100%, 460px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: n-rise var(--t-slow) var(--ease) both;
}
.confirm__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  border-block-end: 1px solid var(--line);
  background: var(--accent-soft);
}
.confirm__pv {
  padding: 14px 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
  line-height: 1.8;
}
.confirm__act {
  display: flex;
  gap: 8px;
  padding: 0 16px 16px;
}
.confirm__act .btn {
  flex: 1;
}
.rest {
  margin: auto;
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
  padding: 48px 16px;
}
.rest .orb {
  --size: 96px;
  margin-block-end: 10px;
}
.rest b {
  font-size: 1.25rem;
  font-weight: 600;
}
.rest p {
  color: var(--muted);
  max-width: 28em;
}
.suggest {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-block-start: 10px;
}
.suggest button {
  padding: 8px 14px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.875rem;
  cursor: pointer;
  transition:
    border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}
.suggest button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.composer {
  flex: none;
  padding: 12px 24px 18px;
}
.composer__in {
  max-width: 780px;
  margin-inline: auto;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transition:
    border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
}
.composer__in:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.composer textarea {
  flex: 1;
  min-height: 42px;
  max-height: 160px;
  resize: none;
  border: 0;
  background: transparent;
  padding: 9px 6px;
  outline: none;
  line-height: 1.6;
}
.composer textarea:disabled {
  cursor: not-allowed;
}
.cbtn {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    background-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}
.cbtn:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--ink);
}
.cbtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.cbtn--send {
  background: var(--accent);
  color: var(--accent-ink);
}
.cbtn--send:hover:not(:disabled) {
  background: var(--accent-hover);
  color: var(--accent-ink);
}
.cbtn:active:not(:disabled) {
  transform: scale(0.92);
}
.cbtn.is-rec {
  background: var(--danger);
  color: #fff;
  animation: rec 1.4s ease-in-out infinite;
}
@keyframes rec {
  50% {
    box-shadow: 0 0 0 6px var(--danger-soft);
  }
}
.composer__hint {
  max-width: 780px;
  margin: 6px auto 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--faint);
}
@media (max-width: 760px) {
  .composer {
    padding: 8px 12px 12px;
  }
  .composer__hint {
    display: none;
  }
}

/* ================= Sheet (dialog) ================= */
dialog.sheet {
  border: 0;
  padding: 0;
  margin: auto;
  width: min(100% - 32px, 480px);
  max-height: min(86vh, 720px);
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
dialog.sheet[open] {
  display: flex;
  flex-direction: column;
  animation: sheet-in var(--t-slow) var(--ease);
}
dialog.sheet::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(2px);
  animation: fade var(--t) var(--ease);
}
@media (max-width: 560px) {
  dialog.sheet {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding-block-end: env(safe-area-inset-bottom, 0px);
  }
  dialog.sheet[open] {
    animation: sheet-up var(--t-slow) var(--ease);
  }
}
@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}
@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.sheet__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 8px;
}
.sheet__head h3 {
  flex: 1;
  font-size: 1.1rem;
}
.sheet__body {
  padding: 8px 20px 20px;
  overflow-y: auto;
  display: grid;
  gap: 12px;
}
.sheet__body p {
  color: var(--muted);
  font-size: 0.925rem;
}
.sheet__act {
  display: grid;
  gap: 8px;
  padding: 0 20px 20px;
}
.conv {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease);
}
.conv:hover {
  border-color: var(--accent);
}
.conv.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.conv__tx {
  flex: 1;
  min-width: 0;
}
.conv__t {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv__s {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ================= Account ================= */
.panel {
  padding: 22px;
  margin-block-end: 16px;
}
.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-block-end: 16px;
}
.panel__head h3 {
  font-size: 1.05rem;
}
.panel__head p {
  color: var(--muted);
  font-size: 0.85rem;
}
.panel .form {
  gap: 14px;
}
.panel__act {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-block-start: 4px;
}
.kv {
  display: grid;
}
.kv div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 11px;
  border-block-end: 1px solid var(--line);
  font-size: 0.925rem;
}
.kv div:last-child {
  border: 0;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  font-weight: 500;
  text-align: end;
}
.plan-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.plan-card.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.plan-card__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.plan-card ul {
  margin: 0;
  padding-inline-start: 18px;
  color: var(--muted);
  font-size: 0.875rem;
}
.plans-list {
  display: grid;
  gap: 10px;
}
.usage {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  margin-block: 6px 16px;
}
.usage span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 600ms var(--ease);
}
.panel--danger {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
}
.panel--danger h3 {
  color: var(--danger);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.auth__art .aurora::after {
  opacity: 0.16;
}
.side {
  width: 264px;
}
.side__user {
  gap: 8px;
  padding: 8px;
}
.side__user .btn--icon {
  --btn-h: 32px;
}
.panel__act {
  justify-content: flex-start;
}
@media (max-width: 560px) {
  .panel__act .btn {
    width: 100%;
  }
}
/* On phones the bottom tabs (or the chat composer) own the bottom edge. */
@media (max-width: 760px) {
  #app:not([hidden]) ~ .toasts {
    inset-block-end: calc(88px + env(safe-area-inset-bottom, 0px));
  }
}

/* ================= Subscription ================= */
.body__in--wide {
  max-width: 1040px;
}
.sub-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  gap: 20px;
  padding: 26px;
  margin-block-end: 18px;
}
.sub-hero .aurora::before,
.sub-hero .aurora::after {
  opacity: 0.18;
}
@media (min-width: 820px) {
  .sub-hero {
    grid-template-columns: 1.3fr 1fr;
    align-items: center;
  }
}
.sub-hero__plan {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.sub-hero__plan h2 {
  font-size: 1.6rem;
  font-weight: 600;
}
.sub-hero__when {
  color: var(--muted);
  margin-block: 6px 0;
}
.sub-hero__when b {
  color: var(--ink);
  font-weight: 500;
}
.sub-hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 16px;
}
.meter {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.meter__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--muted);
}
.meter__top b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.meter .usage {
  margin: 0;
}
.meter__days {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.meter__days b {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.meter__days span {
  color: var(--muted);
  font-size: 0.875rem;
}
.notice-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-block-end: 18px;
  background: var(--accent-soft);
  font-size: 0.925rem;
}
.notice-card .icon {
  color: var(--accent);
  margin-block-start: 2px;
}
.notice-card > div {
  flex: 1;
}
.notice-card.is-warn {
  background: var(--warn-soft);
}
.notice-card.is-warn .icon {
  color: var(--warn);
}
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-block: 30px 14px;
}
.section-title h2 {
  font-size: 1.2rem;
}
.section-title p {
  color: var(--muted);
  font-size: 0.875rem;
}
.tiers {
  display: grid;
  gap: 14px;
}
@media (min-width: 900px) {
  .tiers {
    grid-template-columns: repeat(3, 1fr);
    align-items: stretch;
  }
}
.tier {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px 22px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--t) var(--ease),
    box-shadow var(--t) var(--ease),
    border-color var(--t) var(--ease);
}
.tier:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.tier.is-featured {
  border: 1.5px solid var(--accent);
  box-shadow: var(--shadow-md);
}
.tier.is-current {
  background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--surface);
}
.tier__flag {
  position: absolute;
  inset-block-start: -11px;
  inset-inline-start: 20px;
  padding: 2px 12px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 500;
}
.tier__flag.is-current {
  background: var(--ink);
  color: var(--bg);
}
.tier h3 {
  font-size: 1.15rem;
}
.tier__for {
  color: var(--muted);
  font-size: 0.85rem;
  min-height: 2.6em;
}
.tier__price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-block: 12px 16px;
}
.tier__price b {
  font-size: 2.6rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tier__price span {
  color: var(--muted);
  font-size: 0.875rem;
}
.tier__price--ask b {
  font-size: 1.5rem;
}
.tier ul {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: grid;
  gap: 9px;
  flex: 1;
  align-content: start;
  font-size: 0.9rem;
}
.tier li {
  display: flex;
  gap: 10px;
}
.tier li .icon {
  width: 18px;
  height: 18px;
  color: var(--ok);
  margin-block-start: 0.2em;
  stroke-width: 2.2;
}
.tier .btn {
  width: 100%;
}
.steps-row {
  display: grid;
  gap: 12px;
}
@media (min-width: 820px) {
  .steps-row {
    grid-template-columns: repeat(3, 1fr);
  }
}
.step-card {
  display: flex;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.step-card__n {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.step-card b {
  display: block;
  font-weight: 500;
  margin-block-end: 2px;
}
.step-card p {
  color: var(--muted);
  font-size: 0.85rem;
}
.qa {
  display: grid;
  gap: 8px;
}
.qa details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.qa summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.qa summary::-webkit-details-marker {
  display: none;
}
.qa summary::after {
  content: "+";
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}
.qa details[open] summary::after {
  content: "−";
}
.qa details p {
  padding: 0 16px 16px;
  color: var(--muted);
  font-size: 0.9rem;
}
.summary-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.summary-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  font-size: 0.925rem;
}
.summary-list div + div {
  border-block-start: 1px solid var(--line);
}
.summary-list dt {
  color: var(--muted);
}
.summary-list dd {
  margin: 0;
  font-weight: 500;
}
.mini-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Already on the plans page: the gate bar needs no link to it. */
.is-plans .gate .link {
  display: none;
}

/* Phone: always LTR — dial code fixed on the left, the number to its right,
   matching the phone app regardless of the page's direction. */
.phone {
  display: flex;
  gap: 8px;
}
/* `.field select` (nabih.css) makes selects full width; inside .phone the
   dial code must size to its content so the number keeps the row. */
.field .phone__cc {
  flex: none;
  width: auto;
  max-width: 46%;
  min-height: 46px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.phone__cc:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field .phone input {
  flex: 1;
  min-width: 0;
  text-align: left;
}
