:root {
  color-scheme: light;
  --background: #f8f7fb;
  --surface: #fff;
  --text: #222034;
  --muted: #625e73;
  --line: #e9e5f0;
  --brand: #5536ba;
  --brand-light: #eee8ff;
  --radius: 24px;
  font: 16px/1.65 "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background: var(--background);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 3px solid #9478fb; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 4vw, 2.2rem); line-height: 1.4; letter-spacing: -.025em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { overflow-wrap: anywhere; }
small, .muted { color: var(--muted); }
[hidden] { display: none !important; }
.shell { width: min(100% - 40px, 880px); margin: auto; padding-bottom: 100px; }
.top { display: flex; justify-content: space-between; align-items: center; min-height: 90px; gap: 12px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 800; font-size: 1.15rem; }
.brand img { display: block; width: 39px; height: 39px; border-radius: 11px; }
.brand b { color: var(--brand); font-size: .86em; }
.badge, .balance { font-size: .82rem; padding: 5px 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--muted); }
.balance { color: var(--brand); }
.hero { min-height: 212px; display: grid; align-items: center; padding: 26px 34px; position: relative; overflow: hidden; border: 1px solid #e8defd; border-radius: 30px; background: radial-gradient(circle at 15% 5%, #e9ddff, transparent 60%), #f1ecfc; }
.hero > div { position: relative; z-index: 1; }
.hero::after { content: ""; position: absolute; inset-inline-end: 4%; top: 0; width: 210px; aspect-ratio: 1; background: repeating-radial-gradient(circle, transparent 0 20px, #baa7e94d 21px 22px); mask-image: linear-gradient(90deg, #000, transparent 96%); pointer-events: none; }
.hero p, .intro p { margin-top: 7px; }
.hero .primary { margin-top: 19px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 27px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.card, .panel { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.card { text-align: start; padding: 17px; color: var(--text); min-height: 141px; transition: border-color .18s, transform .18s; }
.card:hover { border-color: #af9fdf; transform: translateY(-2px); }
.card strong { display: block; margin-top: 10px; }
.card small { display: block; overflow-wrap: anywhere; }
.mark { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: #59409a; background: #eee7ff; font-size: 1.33rem; flex-shrink: 0; }
.mark.waiter { background: #fff0db; color: #905b23; }
.mark.study { background: #e6efff; color: #365a9a; }
.mark.clinic { background: #e4f4ed; color: #30624c; }
.mark.friend { background: #fce8ef; color: #9b4266; }
.mark.office { background: #e8e7fd; color: #5148a0; }
.primary, .secondary, .plain { border-radius: 13px; border: 1px solid transparent; padding: 8px 14px; min-height: 44px; font-weight: 650; }
.primary { background: var(--brand); color: white; }
.secondary { background: var(--brand-light); color: var(--brand); }
.plain { background: transparent; color: var(--brand); padding-inline: 7px; }
.nav { position: fixed; z-index: 2; bottom: 14px; right: 50%; transform: translateX(50%); display: flex; justify-content: space-evenly; gap: 5px; width: min(100% - 32px, 440px); padding: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); background: #ffffffed; backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 7px 25px #23124713; }
.nav button { flex: 1; border: 0; background: transparent; color: var(--muted); border-radius: 15px; font-size: .75rem; padding: 3px 2px; min-height: 52px; }
.nav span { display: block; font-size: 1.15rem; line-height: 1.25; }
.nav [aria-current="page"] { background: var(--brand-light); color: var(--brand); font-weight: bold; }
.panel { padding: 20px; margin-top: 14px; }
.auth { width: min(100%, 425px); margin: clamp(8px, 8dvh, 72px) auto 0; }
.auth .panel { padding: clamp(18px, 5vw, 30px); }
form, .fields { display: grid; gap: 13px; }
label { display: grid; gap: 5px; font-size: .9rem; font-weight: 600; }
input, textarea, select { color: var(--text); border: 1px solid #ded9e9; background: #fbfafd; border-radius: 12px; padding: 8px 11px; width: 100%; }
input[type=file] { font-size: .81rem; }
textarea { min-height: 86px; resize: vertical; }
.row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }
.profile { display: flex; gap: 12px; align-items: center; }
.title-wrap { display: grid; gap: 1px; }
.messages { display: grid; gap: 13px; max-height: min(52dvh, 500px); overflow-y: auto; padding: 10px 3px; min-height: 116px; align-content: start; }
.bubble { max-width: min(90%, 610px); width: fit-content; padding: 10px 14px; border-radius: 18px 18px 5px 18px; border: 1px solid var(--line); background: #f7f6fa; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.user { justify-self: end; background: var(--brand-light); border-color: transparent; border-radius: 18px 18px 18px 5px; }
.composer textarea { min-height: 65px; }
.entry { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding: 10px 0; gap: 9px; overflow-wrap: anywhere; }
.entry:last-child { padding-bottom: 0; }
#notice { position: fixed; z-index: 5; bottom: 88px; right: 50%; transform: translateX(50%); width: max-content; max-width: calc(100% - 30px); border-radius: 14px; padding: 10px 17px; background: #272039; color: white; box-shadow: 0 7px 26px #23124728; }
.error { color: #9b263e; }
audio { width: 100%; }
.intro { margin: 10px 0 18px; }
.note { margin-top: 9px; }
details > summary { cursor: pointer; font-weight: 700; }
@media (max-width: 640px) {
  .shell { width: calc(100% - 28px); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .top { min-height: 72px; }
  .hero { padding: 22px; min-height: 190px; }
  .hero::after { inset-inline-end: -40px; opacity: .6; }
  .card { padding: 13px; min-height: 132px; }
  .panel { padding: 15px; }
}
