/* Rayye7 chat: ink on paper. Black and white with soft, substantial shapes (AGENTS.md branding). Colour appears
   only where it means something: green for done, amber for a code to use now, red for a problem. */
:root {
  color-scheme: light dark;
  --paper: #f3f3f1;
  --sheet: #ffffff;
  --ink: #131315;
  --ink-2: #45454c;
  --ink-3: #6e6e76;
  --line: #e2e2de;
  --wash: #ecece8;
  --bubble: #131315;
  --on-bubble: #ffffff;
  --ok: #1d7a4c;
  --warn-wash: #fff3cf;
  --warn-edge: #e3bb4f;
  --bad: #b3261e;
  --shadow: 0 1px 2px rgb(19 19 21 / 5%), 0 12px 32px -16px rgb(19 19 21 / 22%);
  --radius: 22px;
  --column: 720px;
  /* The Send button; a shop's own colour replaces it (brand.css, DECISIONS.md D45). */
  --send-bg: var(--ink);
  --send-fg: var(--paper);
  --gutter: max(16px, calc((100% - var(--column)) / 2));
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", "Segoe UI Arabic", Tahoma, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", "Segoe UI Variable Display", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Roboto Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e0f11;
    --sheet: #17181b;
    --ink: #f1f1ee;
    --ink-2: #b9b9c0;
    --ink-3: #8a8a93;
    --line: #2a2b30;
    --wash: #222327;
    --bubble: #2a2b31;
    --on-bubble: #f1f1ee;
    --ok: #5fd197;
    --warn-wash: #2b2312;
    --warn-edge: #7d6220;
    --bad: #ff8a80;
    --shadow: 0 1px 2px rgb(0 0 0 / 50%), 0 14px 32px -16px rgb(0 0 0 / 70%);
  }
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  margin: 0;
  font: 16px/1.55 var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
[hidden] { display: none !important; }

/* Header: the shop first (its own identity), the assistant second. */
.top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) var(--gutter) 12px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.top > strong { font: 650 17px/1.25 var(--font-round); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: var(--ink);
  color: var(--paper);
  font: 700 18px/1 var(--font-round);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.shop, .status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop { font: 650 17px/1.25 var(--font-round); letter-spacing: -.01em; }
.status { font-size: 13px; line-height: 1.35; color: var(--ink-2); }
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 6px 1px 0;
  border-radius: 50%;
  background: var(--ok);
  vertical-align: middle;
}
.leave { flex: none; margin: 0; }
.mark-logo { background: none; border-radius: 50%; object-fit: contain; }
.linkbtn {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
}
.linkbtn:hover { border-color: var(--ink-3); color: var(--ink); }
.linkbtn.signin { flex: none; border-color: var(--ink); color: var(--ink); font-weight: 600; }

/* The conversation: one readable column. The assistant writes on the page; the customer speaks in ink. */
#log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px var(--gutter) 28px;
}
.hello { margin: 4px 2px 8px; }
.hello:only-child { margin-block: auto; padding-bottom: 8vh; text-align: center; }
.hello-logo { display: block; width: 56px; height: 56px; margin: 0 0 12px; }
.hello:only-child .hello-logo { width: 96px; height: 96px; margin: 0 auto 18px; }
.hello-title { margin: 0; font: 650 24px/1.25 var(--font-round); letter-spacing: -.02em; }
.hello-text { margin: 6px 0 0; color: var(--ink-2); }
.hello-ar { margin: 10px 0 0; color: var(--ink-2); text-align: left; }
.hello:only-child .hello-ar { text-align: center; }

.msg { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.assistant, .msg.user { font-size: 17px; }
.msg.assistant { align-self: stretch; padding: 0 2px; line-height: 1.6; }
.msg.user {
  align-self: flex-end;
  max-width: min(84%, 540px);
  padding: 10px 16px;
  border-radius: 22px 22px 6px 22px;
  background: var(--bubble);
  color: var(--on-bubble);
}
.msg.user em { font-style: normal; opacity: .7; }
.msg.user.failed { opacity: .5; } /* not sent: its words are back in the box */
.msg.notice .linkbtn { margin-left: 4px; padding: 3px 10px; font-size: 12px; }
.msg.notice { align-self: center; max-width: 92%; font-size: 13px; color: var(--ink-2); text-align: center; }
.msg.code, .msg.link {
  align-self: stretch;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-weight: 600;
}
.msg.code { border: 1px solid var(--warn-edge); background: var(--warn-wash); }
.msg.link { border: 1px solid var(--line); background: var(--sheet); box-shadow: var(--shadow); }
.msg.done { display: flex; align-items: flex-start; gap: 12px; white-space: normal; }
.private-link {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font: 500 14px/1.45 var(--font-mono);
  overflow-wrap: anywhere;
  text-underline-offset: 3px;
}
.fresh { animation: rise .24s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* The thinking line, the chat's signature: the shop's mark breathes while the line names the step the app is
   really on, with light passing over the words. The same mark waits on a delivery card that is still being prepared. */
.msg.thinking { display: flex; align-items: center; gap: 10px; min-height: 26px; padding: 0 2px; white-space: normal; }
.pulse, .card-state::before {
  width: 14px;
  height: 14px;
  border-radius: 5px;
  background: var(--ink);
  animation: breathe 1.6s ease-in-out infinite;
}
.pulse { flex: none; }
/* With the shop's emblem, the emblem itself breathes (DECISIONS.md D45). */
.pulse-logo { flex: none; width: 24px; height: 24px; animation: breathe-logo 1.8s ease-in-out infinite; }
@keyframes breathe-logo {
  0%, 100% { transform: scale(.84) rotate(-10deg); opacity: .75; }
  50% { transform: scale(1) rotate(10deg); opacity: 1; }
}
@keyframes breathe {
  0% { transform: scale(.72) rotate(0deg); opacity: .45; border-radius: 7px; }
  50% { transform: scale(1) rotate(90deg); opacity: 1; border-radius: 4px; }
  100% { transform: scale(.72) rotate(180deg); opacity: .45; border-radius: 7px; }
}
.step { font-size: 15px; color: var(--ink-2); animation: arrive .25s ease-out; }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .step {
    background: linear-gradient(100deg, var(--ink-3) 40%, var(--ink) 50%, var(--ink-3) 60%) 0 0 / 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: sheen 2s linear infinite, arrive .25s ease-out;
  }
}
@keyframes sheen { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes arrive { from { opacity: 0; transform: translateX(-4px); } }

/* Done: a green tick, drawn in the colour of the sheet it sits on. */
.tick, .netflix-card[data-state="ready"] .card-state {
  position: relative;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ok);
}
.tick::after, .netflix-card[data-state="ready"] .card-state::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 6px;
  height: 11px;
  border: solid var(--sheet);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Cards the app writes (payment, Netflix, Shahid, UShare): sheets with one clear action each. */
.msg.card {
  align-self: stretch;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheet);
  box-shadow: var(--shadow);
  white-space: normal;
}
.card-amount { font: 700 32px/1.1 var(--font-round); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.card-field { margin: 14px 0 0; }
.card-label { margin-bottom: 6px; font-size: 13px; color: var(--ink-2); }
.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 6px 6px 6px 14px;
  border-radius: 16px;
  background: var(--wash);
}
.card-value { min-width: 0; font: 600 16px/1.35 var(--font-mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.credential-actions { display: flex; flex-shrink: 0; gap: 6px; }
a.copy { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; } /* Open (D57) */
.copy, fieldset button {
  flex: none;
  min-height: 40px;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease;
}
.copy:hover, fieldset button:hover { opacity: .88; }
.copy:active, fieldset button:active { transform: scale(.97); }
.copy:disabled, fieldset button:disabled { opacity: .45; cursor: default; transform: none; }
.card-row .copy, .copy.quiet { background: var(--sheet); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.card-row .copy { min-width: 76px; }
.card-line { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
/* Paying is a sequence, so the payment card numbers its steps; then it says it is waiting (D45). */
.step-no {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font: 700 12px/1 var(--font-round);
  vertical-align: 1px;
}
.card-step { display: flex; align-items: flex-start; gap: 0; margin-top: 14px; font-size: 14px; color: var(--ink-2); }
.card-wait {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--wash);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.ends-soon { color: var(--ink); font-weight: 600; }
.card-policy { color: var(--ink); font-weight: 600; }
.phone-error { color: var(--bad); font-weight: 600; }

.card-head { display: flex; align-items: flex-start; gap: 12px; }
.card-titles { min-width: 0; }
.card-titles strong { display: block; font: 650 18px/1.3 var(--font-round); letter-spacing: -.01em; }
.card-meta { margin-top: 2px; font-size: 13px; font-variant-numeric: tabular-nums; }
.card-state { position: relative; flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; }
.card-state::before { content: ""; }
.netflix-card[data-state="ready"] .card-state::before { content: none; }
.netflix-card fieldset { min-width: 0; margin: 16px 0 0; padding: 0; border: 0; }
.netflix-card legend { margin-bottom: 6px; padding: 0; font-size: 13px; color: var(--ink-2); }
.netflix-card input[type="tel"], .tv-row input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  font-size: 16px;
}
.netflix-card input:focus { outline: none; border-color: var(--ink); }
.netflix-card input[type="tel"] { display: block; margin-bottom: 10px; }
.netflix-card [data-reveal] { display: block; width: 100%; min-height: 46px; margin-top: 16px; }
.card-glyph {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--wash);
  color: var(--ink);
}
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.card-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
/* Netflix code and Add TV, folded under the plan's details (ChatGPT audit, 26 November 2026). */
.card-help { margin-top: 18px; border-top: 1px solid var(--line); }
.card-help > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  list-style: none;
  font: 650 15px/1.3 var(--font-round);
  cursor: pointer;
}
.card-help > summary::-webkit-details-marker { display: none; }
.card-help > summary::after { content: "+"; flex: none; font: 500 22px/1 var(--font-round); color: var(--ink-2); }
.card-help[open] > summary::after { content: "\2212"; }
.card-help > .card-section:first-of-type { margin-top: 12px; padding-top: 0; border-top: 0; }
.phone-review { margin-top: 16px; }
.card-for { margin-bottom: 2px; }
.section-title { margin: 0; font: 650 15px/1.3 var(--font-round); }
.card-section > .copy { margin-top: 12px; }
.code-result.has-code {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--warn-edge);
  border-radius: 16px;
  background: var(--warn-wash);
  color: var(--ink);
}
.code-label, .code-note { flex-basis: 100%; font-size: 13px; color: var(--ink-2); }
.code-value { margin-inline-end: auto; font: 700 30px/1.1 var(--font-mono); letter-spacing: .16em; font-variant-numeric: tabular-nums; }
.tv-row { display: flex; gap: 8px; margin-top: 12px; }
.tv-row input { flex: 1; font: 600 18px/1.2 var(--font-mono); letter-spacing: .12em; }
.tv-row input::placeholder { font: 400 15px/1.2 var(--font-body); letter-spacing: 0; color: var(--ink-3); }

/* The page without scripts that shows a delivered login (netflix_delivery.html) uses the same sheet. */
.msg.card h1 { margin: 0; font: 650 20px/1.3 var(--font-round); letter-spacing: -.01em; }
.msg.card dl { margin: 16px 0 0; }
.msg.card dt { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.msg.card dd { margin: 4px 0 0; }
.msg.card code { font: 600 16px/1.35 var(--font-mono); overflow-wrap: anywhere; }
.msg.card a { color: var(--ink); text-underline-offset: 3px; }

/* The message box: one soft capsule, always within thumb reach; the chat fades out under it. */
form#form {
  position: relative;
  flex: none;
  padding: 8px var(--gutter) max(12px, env(safe-area-inset-bottom));
  background: var(--paper);
}
form#form::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  height: 24px;
  background: linear-gradient(to top, var(--paper), transparent);
  pointer-events: none;
}
.row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--sheet);
  box-shadow: var(--shadow);
  transition: border-color .15s ease;
}
.row:focus-within { border-color: var(--ink-2); }
.attach {
  position: relative; /* keeps the hidden photo input next to its button */
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--wash);
  color: var(--ink-2);
  cursor: pointer;
  transition: color .15s ease;
}
.attach:hover { color: var(--ink); }
.attach:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
#text {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  font-size: 16px;
  outline: none;
}
#text::placeholder { color: var(--ink-3); }
#send {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--send-bg);
  color: var(--send-fg);
  cursor: pointer;
  transition: transform .12s ease, opacity .15s ease;
}
#send:active { transform: scale(.94); }
#send:disabled, #text:placeholder-shown + #send { opacity: .3; }
#send:disabled { cursor: default; transform: none; }
.has-photo #text:placeholder-shown + #send:not(:disabled) { opacity: 1; }
/* A chosen photo: a small preview, what to send, and Remove (ChatGPT audit, 26 November 2026). */
.photo-preview { display: flex; align-items: center; gap: 10px; margin: 0 8px 8px; }
.photo-preview img {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--line);
  box-shadow: 0 0 0 1px var(--line);
}
.photo-text { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; margin: 0; font-size: 13px; }
.photo-hint { color: var(--ink-2); }
.photo-preview .linkbtn { flex: none; }
.human-help { margin: 8px 0 0; text-align: center; font-size: 12px; }
.human-help a { color: var(--ink-2); text-underline-offset: 2px; }

@media (max-width: 480px) {
  .wide-only { display: none; }
  #log { gap: 14px; padding-top: 18px; }
  .msg.card { padding: 16px; }
  .card-amount { font-size: 28px; }
  .hello-title { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .step { background: none; color: var(--ink-2); }
}
