/* رصين — motion, launch film, upload surfaces and the AI waiting states. Loaded after app.css. */
:root { --ease: cubic-bezier(.22, .8, .24, 1); --spring: cubic-bezier(.34, 1.4, .5, 1); }

/* ---------- Launch film (the same film the Mac and iPhone apps open with) ---------- */
.intro { position: fixed; inset: 0; z-index: 500; background: #0E1828; display: grid; place-items: center; cursor: pointer; transition: opacity .55s var(--ease), visibility .55s; }
.intro.leaving { opacity: 0; visibility: hidden; }
.intro.leaving .intro-stage { transform: scale(1.06); }
.intro-stage { width: min(100vw, 100vh); aspect-ratio: 1; transition: transform .6s var(--ease);
  -webkit-mask: radial-gradient(circle at center, #000 58%, transparent 72%); mask: radial-gradient(circle at center, #000 58%, transparent 72%); }
.intro-stage video { width: 100%; height: 100%; object-fit: contain; display: block; }
.intro.ended { background: #14223A; }
.intro-still { width: min(320px, 70vw); animation: rise-soft .7s var(--ease); }
.intro-bar { position: absolute; inset-inline: 0; bottom: 34px; display: flex; justify-content: center; gap: 12px; opacity: 0; animation: fade-in .5s .9s forwards; }
.intro-bar button { background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .16); color: #C9D1DD; border-radius: 999px; padding: 8px 18px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; font-size: 13px; }
.intro-bar button:hover { background: rgba(255, 255, 255, .15); color: #fff; }
@keyframes fade-in { to { opacity: 1; } }
@keyframes rise-soft { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ---------- The mark, drawn and alive ---------- */
.rmark { display: block; overflow: visible; }
.rmark .r-belly { fill: currentColor; } .rmark .r-ink { fill: none; stroke: currentColor; } .rmark .r-fill { fill: currentColor; }
.rmark .r-dot { fill: var(--gold-light); }
.rmark.draw .r-body { animation: r-settle .8s var(--ease) both; transform-origin: 100px 186px; }
.rmark.draw .r-beam { stroke-dasharray: 140; animation: r-trace .7s .45s var(--ease) both; }
.rmark.draw .r-scale { animation: r-scale-in .6s .75s var(--spring) both; transform-origin: 100px 90px; }
.rmark.draw .r-nib { animation: r-nib .55s .6s var(--ease) both; transform-origin: 100px 178px; }
.rmark.draw .r-dot { animation: r-drop .65s 1.05s cubic-bezier(.5, 0, .4, 1.6) both; transform-origin: 100px 60px; }
@keyframes r-settle { from { opacity: 0; transform: translateY(18px) scale(.94); } }
@keyframes r-trace { from { stroke-dashoffset: 140; } to { stroke-dashoffset: 0; } }
@keyframes r-scale-in { from { opacity: 0; transform: translateY(-10px); } }
@keyframes r-nib { from { opacity: 0; transform: scaleY(.2); } }
@keyframes r-drop { from { opacity: 0; transform: translateY(-64px) scale(.4); } }
.rmark.think .r-swing { animation: r-swing 2.4s ease-in-out infinite; transform-origin: 100px 60px; }
.rmark.think .r-dot { animation: r-pulse 2.4s ease-in-out infinite; transform-origin: 100px 60px; }
@keyframes r-swing { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes r-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }

/* ---------- Sign-in ---------- */
.auth-brand::before { content: ''; position: absolute; inset: -320px; background: url('/assets/img/pattern-deep.svg'); background-size: 320px; animation: drift 60s linear infinite; opacity: .9; }
.auth-brand { background-image: none; }
@keyframes drift { to { transform: translate(320px, 320px); } }
.auth-brand .glow { position: absolute; z-index: 1; width: 620px; height: 620px; border-radius: 50%; inset-inline-start: 8%; top: 6%; background: radial-gradient(circle, rgba(224, 184, 103, .16), transparent 65%); animation: breathe 7s ease-in-out infinite; pointer-events: none; }
@keyframes breathe { 50% { transform: scale(1.14); opacity: .7; } }
.auth-brand .wordmark { display: flex; align-items: center; gap: 18px; } .auth-brand .hero-mark { width: clamp(76px, 8vw, 112px); color: var(--paper); } .auth-brand .wordmark b { font: 900 clamp(44px, 4.6vw, 66px)/1.1 var(--display); display: block; } .auth-brand .wordmark span { color: #C3CBD8; font-size: 17px; }
.auth-brand > div > *, .auth-points > div, .auth-card > * { animation: rise-soft .7s var(--ease) both; }
.auth-brand h1 { animation-delay: .5s; } .auth-brand p { animation-delay: .65s; }
.auth-points > div:nth-child(1) { animation-delay: .8s; } .auth-points > div:nth-child(2) { animation-delay: .92s; } .auth-points > div:nth-child(3) { animation-delay: 1.04s; }
.auth-card > *:nth-child(2) { animation-delay: .1s; } .auth-card > *:nth-child(3) { animation-delay: .18s; } .auth-card > *:nth-child(4) { animation-delay: .26s; } .auth-card > *:nth-child(5) { animation-delay: .34s; }
.password-wrap { position: relative; } .password-wrap .input { padding-inline-end: 46px; }
.password-wrap button { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 8px; color: var(--text-3); cursor: pointer; border-radius: 8px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

/* ---------- Page entrance, hover, press ---------- */
.page > * { animation: page-in .42s var(--ease) both; }
.page > *:nth-child(2) { animation-delay: .05s; } .page > *:nth-child(3) { animation-delay: .1s; } .page > *:nth-child(4) { animation-delay: .15s; } .page > *:nth-child(n+5) { animation-delay: .18s; }
@keyframes page-in { from { opacity: 0; transform: translateY(12px); } }
a.panel, .panel.hover { transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
a.panel:hover, .panel.hover:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(21, 35, 58, .06), 0 16px 36px rgba(21, 35, 58, .12); }
.nav a { transition: background .18s, color .18s, padding .2s var(--ease); } .nav a:hover svg { transform: scale(1.08); } .nav a svg { transition: transform .2s var(--spring); }
.tabs button { transition: background .2s, color .2s, box-shadow .2s; }
.tick { transition: background .2s, border-color .2s, transform .2s var(--spring); } .tick:active { transform: scale(.85); } .tick.done svg { animation: pop .3s var(--spring); }
@keyframes pop { from { transform: scale(0); } }
.meter > i { transition: width .9s var(--ease); transform-origin: right; animation: grow-x .9s var(--ease); }
@keyframes grow-x { from { transform: scaleX(0); } }
@property --p { syntax: '<number>'; inherits: false; initial-value: 0; }
.ring { transition: --p 1.2s var(--ease); }
.skeleton { display: grid; gap: 14px; } .skeleton i { display: block; border-radius: 14px; height: 18px; background: linear-gradient(100deg, var(--sunken) 30%, var(--line-soft) 50%, var(--sunken) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton i.block { height: 130px; border-radius: var(--r-panel); } .skeleton i.short { width: 45%; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -150% 0; } }

/* ---------- Upload ---------- */
.drop { border: 2px dashed var(--line); border-radius: 20px; padding: 34px 20px; text-align: center; cursor: pointer; background: var(--surface-2); transition: border-color .2s, background .2s, transform .2s var(--ease); display: grid; justify-items: center; gap: 8px; }
.drop:hover, .drop:focus-visible { border-color: var(--accent); }
.drop.over { border-color: var(--gold); background: rgba(185, 138, 62, .1); transform: scale(1.01); }
.drop .drop-icon { width: 62px; height: 62px; border-radius: 20px; display: grid; place-items: center; background: rgba(185, 138, 62, .14); color: var(--gold); transition: transform .25s var(--spring); }
.drop.over .drop-icon { transform: translateY(-6px) scale(1.08); }
.drop b { font: 700 18px/1.4 var(--display); } .drop span { color: var(--text-2); font-size: 13px; }
.drop.compact { padding: 14px; grid-template-columns: auto 1fr; text-align: start; align-items: center; justify-items: start; } .drop.compact .drop-icon { width: 42px; height: 42px; border-radius: 13px; } .drop.compact b { font-size: 15px; }
.formats { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.formats i { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 7px; background: var(--sunken); color: var(--text-2); direction: ltr; }
.files { display: grid; gap: 10px; margin-top: 12px; } .files:empty { display: none; }
.file { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-soft); animation: rise-soft .35s var(--ease); position: relative; overflow: hidden; }
.file .thumb { width: 46px; height: 58px; border-radius: 8px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; color: var(--gold); overflow: hidden; } .file .thumb canvas, .file .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.file .bar { position: absolute; inset-inline-start: 0; bottom: 0; height: 3px; background: var(--gold-light); transition: width .2s; width: 0; }
.file.bad { border-color: var(--negative); background: var(--negative-soft); }
.page-drop { position: fixed; inset: 14px; z-index: 90; border: 3px dashed var(--gold-light); border-radius: 26px; background: rgba(21, 35, 58, .82); color: #fff; display: grid; place-items: center; font: 800 26px var(--display); pointer-events: none; animation: fade .15s; }
.attach-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 6px 6px; } .attach-row:empty { display: none; }
.attach-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 11px; background: var(--sunken); font-size: 13px; max-width: 260px; border: 0; color: inherit; } button.attach-chip { cursor: pointer; } .attach-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.user .attach-chip { background: rgba(255, 255, 255, .16); color: inherit; } .msg.user .attach-row { padding: 0 0 8px; }
.pdf-view { display: grid; gap: 14px; justify-items: center; background: var(--sunken); border-radius: 16px; padding: 16px; max-height: 72vh; overflow: auto; } .pdf-view canvas { max-width: 100%; height: auto !important; border-radius: 6px; box-shadow: var(--shadow); background: #fff; }

/* ---------- AI at work ---------- */
.ai-card { position: relative; overflow: hidden; border-radius: 20px; background: var(--deep); color: var(--paper); padding: 22px 24px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.ai-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(224, 184, 103, .14) 50%, transparent 70%); background-size: 260% 100%; animation: shimmer 2.8s linear infinite; }
.ai-card > * { position: relative; } .ai-card .rmark { width: 58px; height: 58px; color: var(--paper); }
.ai-card b { font: 700 17px/1.5 var(--display); display: block; } .ai-card .activity { color: #C3CBD8; font-size: 14px; min-height: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-card .time { direction: rtl; color: var(--gold-light); font-weight: 700; } .ai-card .btn { background: rgba(255, 255, 255, .1); color: #fff; }
.ai-stream { max-height: 46vh; overflow-y: auto; margin-top: 14px; } .ai-stream .prose > *:last-child::after { content: ''; display: inline-block; width: 8px; height: 17px; background: var(--gold); margin-inline-start: 5px; vertical-align: -3px; border-radius: 2px; animation: caret 1s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.stages { display: grid; gap: 4px; margin-top: 18px; counter-reset: stage; }
.stage { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; padding: 10px 4px; position: relative; }
.stage::before { content: ''; position: absolute; inset-inline-start: 23px; top: 46px; bottom: -8px; width: 2px; background: var(--line-soft); } .stage:last-child::before { display: none; } .stage.done::before { background: var(--positive); }
.stage .dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); color: var(--text-3); font: 700 15px var(--display); transition: background .3s, color .3s; z-index: 1; }
.stage.done .dot { background: var(--positive); color: #fff; } .stage.done .dot svg { animation: pop .35s var(--spring); } .stage.running .dot { background: var(--gold-light); color: var(--deep); animation: halo 1.6s infinite; }
@keyframes halo { from { box-shadow: 0 0 0 0 rgba(224, 184, 103, .55); } to { box-shadow: 0 0 0 14px rgba(224, 184, 103, 0); } }
.stage b { display: block; } .stage small { color: var(--text-2); } .stage.running small { color: var(--gold); font-weight: 600; } .stage.pending { opacity: .6; }
.msg { animation: rise-soft .3s var(--ease); }
.msg.user { max-width: min(70%, 720px); } .msg .msg-tools { display: flex; gap: 4px; margin-top: 10px; } .msg .msg-tools button { background: none; border: 0; padding: 6px; border-radius: 8px; color: var(--text-3); cursor: pointer; } .msg .msg-tools button:hover { background: var(--sunken); color: var(--text); }

/* ---------- Contract review ---------- */
.clause { border: 1px solid var(--line-soft); border-inline-start: 4px solid var(--line); border-radius: 16px; padding: 18px; background: var(--surface-2); animation: rise-soft .4s var(--ease) both; }
.clause.high { border-inline-start-color: var(--negative); } .clause.medium { border-inline-start-color: var(--amber); } .clause.low { border-inline-start-color: var(--positive); }
.clause header { display: flex; gap: 10px; align-items: center; justify-content: space-between; } .clause header b { font: 700 16px/1.5 var(--display); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; } .compare > div { border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; line-height: 1.9; } .compare small { display: block; font-weight: 700; margin-bottom: 4px; }
.compare .old { background: var(--negative-soft); } .compare .old small { color: var(--negative); } .compare .new { background: var(--positive-soft); } .compare .new small { color: var(--positive); }
.verdict { font: 800 22px/1.5 var(--display); margin: 2px 0 8px; }
.ring.big { width: 148px; height: 148px; } .ring.big::before { width: 118px; height: 118px; } .ring.big b { font-size: 34px; text-align: center; line-height: 1.1; } .ring.big b small { display: block; font: 500 12px var(--font); color: var(--text-2); }
.timeline { display: grid; } .timeline > div { display: grid; grid-template-columns: 110px 18px minmax(0, 1fr); gap: 10px; padding-bottom: 16px; position: relative; } .timeline > div::before { content: ''; position: absolute; inset-inline-start: 128px; top: 18px; bottom: -4px; width: 2px; background: var(--line-soft); } .timeline > div:last-child::before { display: none; } .timeline i { width: 12px; height: 12px; border-radius: 50%; background: var(--gold); margin-top: 8px; z-index: 1; justify-self: center; } .timeline time { color: var(--gold); font-weight: 600; font-size: 14px; }
.scale5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 14px; } .scale5 span { text-align: center; font-size: 12px; color: var(--text-3); padding-top: 14px; position: relative; } .scale5 span::before { content: ''; position: absolute; top: 0; inset-inline: 0; height: 8px; border-radius: 99px; background: var(--sunken); } .scale5 span.on { color: var(--text); font-weight: 700; } .scale5 span.on::before { background: var(--c); }
.flag-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; } .flag-list li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; } .flag-list svg { margin-top: 5px; color: var(--gold); }

/* ---------- Palette, onboarding, mobile bar ---------- */
.palette { width: min(680px, 100%); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; align-self: start; margin-top: 10vh; animation: rise .18s var(--ease); }
.palette input { width: 100%; border: 0; background: none; padding: 20px 24px; font-size: 18px; outline: none; border-bottom: 1px solid var(--line-soft); }
.palette-list { max-height: 56vh; overflow-y: auto; padding: 8px; } .palette-list h4 { margin: 8px 14px 4px; font-size: 12px; color: var(--text-3); font-weight: 600; }
.palette-list button { width: 100%; display: flex; gap: 12px; align-items: center; text-align: start; border: 0; background: none; padding: 11px 14px; border-radius: 12px; cursor: pointer; } .palette-list button.on { background: var(--accent-soft); } .palette-list small { color: var(--text-2); margin-inline-start: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.kbd { font: 600 11px var(--font); padding: 2px 7px; border-radius: 6px; background: var(--sunken); color: var(--text-2); direction: ltr; }
.search-box button.input { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-box .kbd { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); }
.onboard { position: fixed; inset: 0; z-index: 300; background: var(--deep); color: var(--paper); overflow: auto; display: grid; place-items: center; padding: 30px 20px; }
.onboard::before { content: ''; position: fixed; inset: -320px; background: url('/assets/img/pattern-deep.svg'); background-size: 320px; animation: drift 60s linear infinite; }
.onboard > div { position: relative; width: min(760px, 100%); display: grid; gap: 22px; } .onboard .rmark { width: 92px; color: var(--paper); }
.onboard h1 { font: 900 clamp(28px, 4vw, 42px)/1.35 var(--display); margin: 0; } .onboard p { color: #C3CBD8; margin: 0; font-size: 16px; }
.persona { display: grid; grid-template-columns: 54px 1fr 26px; gap: 16px; align-items: center; text-align: start; padding: 18px 20px; border-radius: 20px; background: rgba(246, 247, 249, .05); border: 1.5px solid rgba(246, 247, 249, .12); color: inherit; cursor: pointer; transition: border-color .2s, background .2s, transform .2s var(--ease); }
.persona:hover { transform: translateY(-2px); background: rgba(246, 247, 249, .08); } .persona.on { border-color: var(--gold-light); background: rgba(224, 184, 103, .1); } .persona .tile { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: rgba(224, 184, 103, .15); color: var(--gold-light); } .persona.on .tile { background: var(--gold-light); color: var(--deep); } .persona b { font: 700 18px/1.5 var(--display); } .persona small { color: #AEB8C7; display: block; }
.onboard .steps { display: flex; gap: 8px; } .onboard .steps i { width: 9px; height: 9px; border-radius: 99px; background: rgba(255, 255, 255, .25); transition: width .3s var(--ease), background .3s; } .onboard .steps i.on { width: 30px; background: var(--gold-light); }
.onboard .step > * { animation: rise-soft .5s var(--ease) both; } .onboard .step > *:nth-child(2) { animation-delay: .08s; } .onboard .step > *:nth-child(3) { animation-delay: .16s; } .onboard .step > *:nth-child(n+4) { animation-delay: .24s; } .onboard .step { display: grid; gap: 16px; }
.mobile-bar { display: none; }
@media (max-width: 900px) {
  .mobile-bar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 40; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(18px); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 6px; }
  .mobile-bar a, .mobile-bar button { display: grid; justify-items: center; gap: 1px; padding: 7px 2px; border-radius: 16px; color: var(--text-2); font-size: 11px; font-weight: 600; background: none; border: 0; text-decoration: none; } .mobile-bar .active { background: var(--accent-soft); color: var(--accent); }
  .content { padding-bottom: 110px; } .compare { grid-template-columns: 1fr; } .ai-card { grid-template-columns: auto 1fr; } .ai-card .btn { grid-column: 1 / -1; } .search-box .kbd { display: none; }
  .timeline > div { grid-template-columns: 78px 18px minmax(0, 1fr); } .timeline > div::before { inset-inline-start: 96px; } .toasts { bottom: 96px; }
}

/* ---------- Printing one document ---------- */
#print-root { display: none; }
@media print {
  body.print-doc > *:not(#print-root) { display: none !important; } body.print-doc #print-root { display: block; color: #111; background: #fff; font: 12pt/1.9 var(--font); }
  #print-root .letterhead { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #B98A3E; padding-bottom: 10px; margin-bottom: 20px; } #print-root .letterhead img { height: 46px; } #print-root h1 { font: 800 20pt var(--display); } #print-root .cite { border: 0; background: none; color: #2F7D5B; padding: 0; } #print-root table { width: 100%; border-collapse: collapse; } #print-root td, #print-root th { border: 1px solid #ccc; padding: 6px 8px; text-align: start; vertical-align: top; } #print-root .clause, #print-root .compare > div { break-inside: avoid; } @page { margin: 18mm; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.topbar .search { min-width: 0; } .search-box button.input { width: 100%; }
@media (max-width: 620px) {
  .topbar .spacer { display: none; } .topbar .new-case span { display: none; } .topbar .new-case { padding-inline: 14px; flex: none; }
  .grid.grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; } .metric { flex-direction: column; align-items: flex-start; padding: 16px; }
}

.composer textarea { min-width: 0; } .chat-main { min-width: 0; }
@media (max-width: 900px) {
  .chat { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .chat-side { display: block; order: 2; max-height: 340px; overflow: auto; } .chat-side:has(.muted:only-child) { display: none; }
  .composer-box { position: sticky; bottom: 92px; z-index: 5; } .composer-box .composer { box-shadow: var(--shadow-lg); }
  .composer .btn-primary { padding-inline: 14px; } .composer .btn-primary span { display: none; }
}
