/* The interview, phones first. */
.i { width: 20px; height: 20px; }
.ic { display: inline-grid; place-items: center; flex: none; }
.ic svg { width: 20px; height: 20px; }

.center-screen { min-height: 100dvh; display: grid; place-items: center; color: var(--primary); }

/* welcome / register / login */
.page { max-width: 520px; margin: 0 auto; padding: calc(28px + env(safe-area-inset-top)) 20px calc(32px + env(safe-area-inset-bottom)); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--fg-2); font-size: 15px; margin-bottom: 28px; }
.mark { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; }
.page h1 { font-size: 26px; letter-spacing: -.2px; margin-bottom: 12px; }
.page h1.h2 { font-size: 22px; margin-bottom: 4px; }
.lead { color: var(--fg-2); font-size: 16.5px; line-height: 1.95; margin-bottom: 24px; }
.sub { color: var(--muted); font-size: 15px; margin-bottom: 24px; }
.facts { list-style: none; padding: 0; margin: 0 0 28px; display: flex; flex-direction: column; gap: 4px; }
.facts li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.facts li:first-child { border-top: 0; }
.facts .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-ink); }
.facts b { display: block; font-size: 15.5px; line-height: 1.6; }
.facts span { color: var(--muted); font-size: 14.5px; line-height: 1.75; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.back { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--primary-ink);
  font-weight: 600; font-size: 15px; padding: 10px 4px; margin: -10px -4px 16px; min-height: 44px; border-radius: var(--r-ctl); }
.back .ic svg { width: 18px; height: 18px; }
.opt { color: var(--faint); font-weight: 400; font-size: 13px; }
.ltr-input { direction: ltr; text-align: right; }
.ltr-input::placeholder { text-align: right; }
fieldset.field { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt-card { position: relative; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-ctl); background: var(--surface); cursor: pointer;
  font-size: 15px; line-height: 1.5; transition: border-color .15s ease, background-color .15s ease; }
.opt-card input { position: absolute; opacity: 0; pointer-events: none; }
.opt-card .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; display: grid; place-items: center; }
.opt-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.opt-card:has(input:checked) .dot { border-color: var(--primary); }
.opt-card:has(input:checked) .dot::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.opt-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
#rSiteOther { margin-top: 8px; }

/* conversation */
.chat { height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.chat-head { flex: none; display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--surface); border-bottom: 1px solid var(--border); min-height: 60px; z-index: 10; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.who .mark { width: 34px; height: 34px; font-size: 17px; }
.who-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.who-text b { font-size: 15.5px; }
.who-text small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface-2); color: var(--fg-2); font-size: 13px; font-weight: 600; flex: none; }
.progress:hover { border-color: var(--border-strong); }
.segs { display: flex; gap: 3px; direction: rtl; }
.seg { width: 9px; height: 9px; border-radius: 3px; background: var(--border-strong); position: relative; overflow: hidden; }
.seg.l1 { background: linear-gradient(to left, var(--primary) 50%, var(--border-strong) 50%); }
.seg.l2 { background: var(--primary); }
.ptext { white-space: nowrap; font-variant-numeric: tabular-nums; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--fg-2);
  border-radius: var(--r-ctl); flex: none; }
.icon-btn:hover { background: var(--surface-2); }
.menu-wrap { position: relative; }
.menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0;
  background: none; border-radius: var(--r-ctl); font-size: 15px; text-align: start; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu .ic svg { width: 18px; height: 18px; color: var(--muted); }
.menu #logoutBtn .ic svg { transform: scaleX(-1); }

.thread { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.thread-inner { max-width: 760px; margin: 0 auto; padding: 20px 16px 12px; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; }
.msg .av svg { width: 16px; height: 16px; }
.who .mark svg { width: 18px; height: 18px; }
.msg .av { width: 28px; height: 28px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; margin-top: 2px; }
.msg .body { min-width: 0; font-size: 16px; line-height: 1.95; overflow-wrap: anywhere; }
.msg.assistant .body { color: var(--fg); padding-top: 1px; }
.msg.user { justify-content: flex-end; }
.msg.user .body { background: var(--user-bubble); border-radius: 16px; border-end-end-radius: 4px; padding: 10px 14px; max-width: min(84%, 560px);
  white-space: pre-wrap; }
.msg .body p:last-child, .msg .body ul:last-child, .msg .body ol:last-child { margin-bottom: 0; }
.msg .body ul, .msg .body ol { margin: .2em 0 .7em; padding-inline-start: 1.3em; }
.msg .body li { margin: .15em 0; }
.msg .body h2, .msg .body h3, .msg .body h4, .msg .body h5 { font-size: 16px; margin: .6em 0 .2em; }
.msg .body strong { font-weight: 700; }
.typing { display: inline-flex; gap: 5px; padding: 12px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.msg-error { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; border-radius: var(--r-card);
  background: var(--danger-soft); color: var(--danger); font-size: 14.5px; line-height: 1.7; }
.msg-error .ic svg { width: 18px; height: 18px; }
.msg-error .btn { margin-inline-start: auto; }
.day { align-self: center; font-size: 12.5px; color: var(--muted); background: var(--surface-2); padding: 2px 12px; border-radius: 999px; }

.composer { flex: none; background: var(--surface); border-top: 1px solid var(--border);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.composer-inner { max-width: 760px; margin: 0 auto; }
.send-form { display: flex; align-items: flex-end; gap: 8px; }
#box { flex: 1; min-height: 48px; max-height: 40dvh; resize: none; border: 1px solid var(--border-strong); border-radius: 22px;
  padding: 11px 16px; background: var(--bg); font-size: 16px; line-height: 1.6; overflow-y: auto; }
#box:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.send { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; flex: none; transition: background-color .15s ease, opacity .15s ease; }
.send:hover { background: var(--primary-hover); }
.send[disabled] { opacity: .45; cursor: not-allowed; }
.send .ic svg { width: 20px; height: 20px; transform: scaleX(-1); }
.send.mic .ic svg { transform: none; }

/* attachments */
.send-form .attach { width: 44px; height: 48px; color: var(--muted); }
.send-form .attach:hover { color: var(--primary-ink); }
.composer.drop { outline: 2px dashed var(--primary); outline-offset: -6px; }
.attach-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; max-height: 30dvh; overflow-y: auto; }
.att { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; padding-inline: 8px 6px; border: 1px solid var(--border);
  border-radius: var(--r-card); background: var(--bg); }
.att.failed { border-color: var(--danger); background: var(--danger-soft); }
.att-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); }
.att-ic { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); flex: none; }
.att-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.5; }
.att-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: auto; unicode-bidi: plaintext; text-align: right; }
.att-meta { font-size: 12.5px; color: var(--muted); }
.att.failed .att-meta { color: var(--danger); }
.att-bar { height: 3px; border-radius: 2px; background: var(--border); overflow: hidden; margin-top: 3px; direction: ltr; }
.att-bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s linear; }
.att.done .att-bar, .att.failed .att-bar { display: none; }
.att-x { width: 40px; height: 40px; border: 0; background: none; color: var(--muted); border-radius: var(--r-ctl); display: grid; place-items: center; flex: none; }
.att-x:hover { background: var(--surface-2); color: var(--danger); }
.att-x svg { width: 18px; height: 18px; }

.msg.user .files-body { max-width: min(84%, 560px); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.fcard { display: flex; flex-direction: column; border-radius: 10px; overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: var(--fg); min-width: 0; }
.fcard img { width: 100%; height: 96px; object-fit: cover; display: block; background: var(--surface-2); }
.fc-ic { height: 64px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); }
.fc-ic svg { width: 26px; height: 26px; }
.fc-name { font-size: 12.5px; padding: 4px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; unicode-bidi: plaintext; text-align: right; }
.files-text { margin-top: 8px; white-space: pre-wrap; }
.typing-note { font-size: 13.5px; color: var(--muted); margin-inline-start: 8px; }

/* recording a voice message */
.rec-bar { display: flex; align-items: center; gap: 8px; }
.rec-cancel { color: var(--danger); }
.rec-status { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px;
  border-radius: 24px; background: var(--danger-soft); color: var(--fg); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); flex: none; animation: recpulse 1.2s ease-in-out infinite; }
@keyframes recpulse { 50% { opacity: .3; } }
#recTime { font-weight: 700; font-size: 15px; min-width: 3.2em; }
.rec-label { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* a voice message in the conversation */
.msg.user .voice-body { min-width: min(260px, 84%); }
.voice-row { display: flex; align-items: center; gap: 10px; }
.vplay { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; flex: none; }
.vplay svg { width: 16px; height: 16px; }
.vbar { flex: 1; height: 4px; border-radius: 2px; background: var(--border-strong); overflow: hidden; direction: ltr; }
.vbar i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 2px; transition: width .2s linear; }
.vdur { font-size: 13px; color: var(--muted); flex: none; }
.vtext { margin-top: 6px; white-space: pre-wrap; }
.vtext.vpending { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.vtext.vpending .spinner { width: 14px; height: 14px; }

.kbd-hint { font-size: 12px; color: var(--faint); margin-top: 6px; padding-inline-start: 16px; }
.done-note { display: flex; gap: 10px; align-items: flex-start; background: var(--success-soft); color: var(--fg); border-radius: var(--r-card);
  padding: 10px 14px; margin-bottom: 10px; font-size: 14.5px; line-height: 1.75; }
.done-note .ic { color: var(--success); margin-top: 2px; }

/* sheets (native <dialog>) */
.sheet { border: 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); border-radius: var(--r-sheet); background: var(--surface);
  color: var(--fg); box-shadow: var(--shadow-lg); width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.sheet::backdrop { background: rgba(15, 23, 42, .45); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.sheet-head .h3 { font-size: 18px; }
.sheet .sub { margin-bottom: 14px; font-size: 14.5px; }
.topic-list { list-style: none; margin: 0; padding: 0; }
.topic-list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); font-size: 15.5px; }
.topic-list li:first-child { border-top: 0; }
.topic-list .ic svg { width: 22px; height: 22px; }
.topic-list .l0 .ic { color: var(--faint); } .topic-list .l1 .ic { color: var(--warning); } .topic-list .l2 .ic { color: var(--success); }
.topic-list .state { margin-inline-start: auto; font-size: 13.5px; color: var(--muted); }
.about p { color: var(--fg-2); font-size: 15px; line-height: 1.9; }

@media (min-width: 600px) {
  .page { padding-top: 64px; }
  .sheet { margin: auto; }
}
@media (max-width: 599px) {
  .sheet { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: var(--r-sheet) var(--r-sheet) 0 0; }
  .who-text small { display: none; }
}
@media (max-width: 360px) {
  .ptext { display: none; }
}

ol { list-style-type: persian; }
