/* Rawaq Portal — the studio's stone, ink and copper. Solid surfaces only (no blur), RTL-first with logical properties. */
:root {
  --stone: #F1EBE1; --stone-2: #F8F4EE; --paper: #FCFAF6; --ink: #161A22; --ink-2: #3A3F4A; --grey: #6B6F78;
  --line: rgba(22, 26, 34, .12); --line-2: rgba(22, 26, 34, .2);
  --copper: #8E4B24; --copper-2: #74391A; --copper-soft: rgba(142, 75, 36, .1); --patina: #3F6B5F; --patina-soft: rgba(63, 107, 95, .12);
  --danger: #A8321E; --radius: 18px; --ease: cubic-bezier(.22, 1, .36, 1);
  --panel: #161A22; --panel-fg: #E9E1D4; --panel-accent: #E7B48D; --glow: #FBF7F0;
  --f-body: 'Readex Pro', 'Segoe UI', Tahoma, sans-serif; --f-display: 'Reem Kufi', 'Readex Pro', sans-serif;
  color-scheme: light;
}
html[lang="en"] { --f-body: 'Manrope', 'Segoe UI', system-ui, sans-serif; --f-display: 'Cormorant Garamond', Georgia, serif; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.rqp { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--stone); color: var(--ink); font-family: var(--f-body); font-size: 1.0625rem; line-height: 1.75;
  -webkit-font-smoothing: antialiased; background-image: radial-gradient(120% 70% at 85% -10%, var(--glow) 0%, transparent 60%), radial-gradient(90% 60% at 0% 110%, rgba(190, 123, 75, .08), transparent 70%); background-attachment: fixed; }
html[lang="en"] body.rqp { font-size: 1rem; line-height: 1.65; }
a { color: var(--copper); text-underline-offset: .2em; }
a:hover { color: var(--copper-2); }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; height: auto; }
code { font-size: .8125rem; word-break: break-all; }
.rqp-skip { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 99; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 10px; }
.rqp-skip:focus { top: 12px; }

/* type */
.rqp-h1 { font-family: var(--f-display); font-weight: 600; font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.6rem); line-height: 1.3; margin: 0 0 .5rem; text-wrap: balance; }
html[lang="en"] .rqp-h1 { line-height: 1.1; }
.rqp-h3 { font-family: var(--f-display); font-weight: 600; font-size: 1.3rem; line-height: 1.4; margin: 0 0 .8rem; }
.rqp-lead { color: var(--ink-2); margin: 0 0 1.4rem; }
.rqp-muted { color: var(--grey); font-size: .9375rem; margin: .25rem 0 .75rem; }
.rqp-eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--patina); font-size: .875rem; font-weight: 500; margin: 0 0 1rem; }
.rqp-eyebrow::before { content: ""; width: 26px; height: 1px; background: currentColor; }

/* buttons */
.rqp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 1.6rem; border: 0; border-radius: 999px; background: var(--copper); color: #FBF6EF;
  font: 600 1rem/1 var(--f-body); text-decoration: none; cursor: pointer; transition: background-color .2s, box-shadow .3s var(--ease), transform .3s var(--ease); box-shadow: 0 12px 26px -16px rgba(142, 75, 36, .7); }
.rqp-btn:hover { background: var(--copper-2); color: #FBF6EF; transform: translateY(-1px); }
.rqp-btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.rqp-btn--ghost:hover { background: var(--copper-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--copper); }

/* forms */
.rqp-form { display: grid; gap: 16px; margin: 0 0 8px; }
.rqp-field { display: grid; gap: 6px; font-weight: 500; font-size: .9375rem; }
.rqp-field small { color: var(--grey); font-weight: 400; }
.rqp-field input, .rqp-field textarea, .rqp-field select { width: 100%; min-height: 52px; padding: 12px 16px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.5 var(--f-body); transition: border-color .2s, box-shadow .2s; }
.rqp-field textarea { min-height: 130px; resize: vertical; }
.rqp-field input[type="file"] { padding: 12px; min-height: 0; }
.rqp-field input:focus, .rqp-field textarea:focus { outline: none; border-color: var(--copper); box-shadow: 0 0 0 4px var(--copper-soft); }
.rqp-field input:disabled { color: var(--grey); background: var(--stone-2); }
.rqp-pass { position: relative; display: block; }
.rqp-pass input { padding-inline-end: 52px; }
.rqp-eye { position: absolute; inset-inline-end: 6px; top: 50%; width: 42px; height: 42px; transform: translateY(-50%); border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B6F78' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 20px; }
.rqp-eye.is-on { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E4B24' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M3 3l18 18'/%3E%3C/svg%3E"); }
.rqp-check { display: flex; align-items: flex-start; gap: 10px; font-size: .9375rem; color: var(--ink-2); cursor: pointer; }
.rqp-check input { width: 20px; height: 20px; margin: 4px 0 0; accent-color: var(--copper); flex: none; }
.rqp-flash { margin: 0 0 16px; padding: 12px 16px; border-radius: 14px; font-size: .9375rem; border: 1px solid transparent; }
.rqp-flash--ok { background: var(--patina-soft); color: #2C5047; border-color: rgba(63, 107, 95, .25); }
.rqp-flash--error { background: rgba(168, 50, 30, .08); color: var(--danger); border-color: rgba(168, 50, 30, .25); }
.rqp-links { margin: 14px 0 6px; font-size: .9375rem; }

/* ---------- sign-in screens ---------- */
.rqp-auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.rqp-auth__art { position: relative; display: grid; place-items: center; overflow: hidden; background: var(--panel); color: var(--panel-fg); }
.rqp-auth__art .rqp-mark { position: relative; z-index: 1; width: min(46%, 300px); height: auto; }
.rqp-auth__art .rqp-door { fill: var(--copper); transform-origin: 50% 100%; animation: rqp-door 1.6s var(--ease) .2s both; }
.rqp-auth__art .rqp-mark path:not(.rqp-door) { stroke-dasharray: 400; stroke-dashoffset: 400; animation: rqp-draw 1.8s var(--ease) forwards; }
.rqp-auth__art .rqp-mark path:nth-child(2) { animation-delay: .25s; }
.rqp-auth__light { position: absolute; inset: auto 0 -30% 0; height: 70%; background: radial-gradient(closest-side, rgba(190, 123, 75, .38), transparent 75%); pointer-events: none; }
@keyframes rqp-draw { to { stroke-dashoffset: 0; } }
@keyframes rqp-door { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
.rqp-auth__panel { display: flex; flex-direction: column; justify-content: center; padding: max(32px, env(safe-area-inset-top, 0px)) clamp(20px, 6vw, 88px) max(32px, env(safe-area-inset-bottom, 0px)); max-width: 620px; width: 100%; margin-inline: auto; }
.rqp-auth__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: clamp(28px, 6vh, 64px); }
.rqp-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: .9375rem; }
.rqp-brand img { height: 40px; width: auto; }
.rqp-lang { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink); text-decoration: none; font-size: .875rem; font-weight: 500; }
.rqp-lang:hover { background: var(--copper-soft); color: var(--ink); }
@media (max-width: 899px) {
  .rqp-auth { grid-template-columns: 1fr; }
  .rqp-auth__art { min-height: 180px; }
  .rqp-auth__art .rqp-mark { width: 92px; }
}

.rqp-legal { margin: 28px 0 0; font-size: .8125rem; color: var(--grey); }
.rqp-legal a { color: var(--grey); }
.rqp-legal a:hover { color: var(--copper); }
.rqp-doc ol { padding-inline-start: 1.3em; display: grid; gap: .6em; }
.rqp-doc li::marker { color: var(--copper); font-weight: 600; }

/* ---------- signed-in app ---------- */
.rqp-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; padding: 10px clamp(16px, 4vw, 40px);
  padding-top: max(10px, env(safe-area-inset-top, 0px)); background: var(--stone-2); border-bottom: 1px solid var(--line); }
.rqp-top .rqp-brand img { height: 34px; }
.rqp-top .rqp-brand span { padding-inline-start: 12px; border-inline-start: 1px solid var(--line-2); color: var(--grey); }
.rqp-top__end { display: flex; align-items: center; gap: 12px; }
.rqp-user { color: var(--ink-2); font-size: .9375rem; }
.rqp-out { color: var(--ink); font-size: .9375rem; text-decoration: none; padding: 8px 12px; border-radius: 10px; }
.rqp-out:hover { background: var(--copper-soft); color: var(--ink); }
.rqp-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); max-width: 1180px; margin: 0 auto; padding: clamp(20px, 3vw, 40px) clamp(16px, 4vw, 40px) 64px; }
.rqp-nav { position: sticky; top: 92px; align-self: start; display: grid; gap: 4px; }
.rqp-nav a { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 14px; color: var(--ink-2); text-decoration: none; font-weight: 500; transition: background-color .2s, color .2s; }
.rqp-nav a:hover { background: var(--copper-soft); color: var(--ink); }
.rqp-nav a[aria-current="page"] { background: var(--ink); color: var(--stone-2); }
.rqp-nav svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rqp-main { min-width: 0; display: grid; gap: 18px; align-content: start; }
.rqp-main > .rqp-h1 { margin-bottom: 4px; }
.rqp-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 28px); box-shadow: 0 1px 2px rgba(22, 26, 34, .03), 0 24px 48px -40px rgba(22, 26, 34, .35); min-width: 0; }
.rqp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 18px; }
.rqp-alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-radius: var(--radius); background: var(--panel); color: var(--panel-fg); text-decoration: none; }
.rqp-alert strong { color: var(--panel-accent); }
.rqp-alert:hover { color: var(--panel-fg); filter: brightness(1.15); }
.rqp-note { border-inline-start: 3px solid var(--copper); }
.rqp-back { margin: 0; font-size: .9375rem; }
.rqp-back a { text-decoration: none; }
.rqp-back a::before { content: "→ "; }
html[dir="ltr"] .rqp-back a::before { content: "← "; }

/* project stages */
.rqp-stages { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 0; counter-reset: s; }
.rqp-stages li { position: relative; display: grid; justify-items: center; gap: 10px; text-align: center; font-size: .875rem; color: var(--grey); padding-top: 4px; }
.rqp-stages li::before { content: ""; position: absolute; top: 12px; inset-inline-start: 50%; width: 100%; height: 2px; background: var(--line); }
.rqp-stages li:last-child::before { display: none; }
.rqp-stages li.is-done::before { background: var(--copper); }
.rqp-stages__dot { position: relative; z-index: 1; width: 18px; height: 18px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 2px var(--line-2); }
.rqp-stages li.is-done .rqp-stages__dot { background: var(--copper); box-shadow: none; }
.rqp-stages li.is-now { color: var(--ink); font-weight: 600; }
.rqp-stages li.is-now .rqp-stages__dot { background: var(--paper); box-shadow: inset 0 0 0 5px var(--copper), 0 0 0 6px var(--copper-soft); }
@media (max-width: 760px) {
  .rqp-stages { grid-template-columns: 1fr; gap: 14px; }
  .rqp-stages li { grid-template-columns: 18px 1fr; justify-items: start; text-align: start; align-items: center; padding: 0; }
  .rqp-stages li::before { top: 18px; inset-inline-start: 8px; width: 2px; height: calc(100% + 14px); }
}

/* data */
.rqp-dl { margin: 0; display: grid; gap: 12px; }
.rqp-dl div { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px dashed var(--line); padding-bottom: 10px; }
.rqp-dl div:last-child { border-bottom: 0; padding-bottom: 0; }
.rqp-dl dt { color: var(--grey); font-size: .9375rem; }
.rqp-dl dd { margin: 0; font-weight: 500; }
.rqp-tag { display: inline-flex; align-items: center; min-height: 28px; padding: 0 12px; border-radius: 999px; font-size: .8125rem; font-weight: 600; background: var(--stone); color: var(--ink-2); }
.rqp-tag--active, .rqp-tag--done { background: var(--patina-soft); color: #2C5047; }
.rqp-tag--trial, .rqp-tag--doing, .rqp-tag--setup { background: var(--copper-soft); color: var(--copper-2); }
.rqp-tag--due, .rqp-tag--new { background: #F3E3D6; color: var(--copper-2); }
.rqp-tag--paused, .rqp-tag--ended { background: rgba(22, 26, 34, .07); color: var(--grey); }
.rqp-meter { height: 8px; border-radius: 99px; background: var(--stone); overflow: hidden; margin: 6px 0 0; }
.rqp-meter span { display: block; height: 100%; width: calc(var(--used) * 100%); background: var(--copper); border-radius: inherit; }
.rqp-list { list-style: none; margin: 0; padding: 0; display: grid; }
.rqp-list li { padding: 16px 0; border-bottom: 1px solid var(--line); }
.rqp-list li:first-child { padding-top: 0; }
.rqp-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.rqp-list__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.rqp-list__head a { color: var(--ink); text-decoration: none; }
.rqp-list__head a:hover { color: var(--copper); }
.rqp-list p { margin: 4px 0 0; }
.rqp-reply { margin-top: 12px; padding: 12px 16px; border-radius: 14px; background: var(--patina-soft); }
.rqp-reply p { margin: 4px 0 0; }
.rqp-table-wrap { overflow-x: auto; }
.rqp-table { width: 100%; border-collapse: collapse; min-width: 520px; font-size: .9375rem; }
.rqp-table th, .rqp-table td { text-align: start; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.rqp-table th { color: var(--grey); font-weight: 500; }

/* documents + signature */
.rqp-doc { line-height: 1.95; }
.rqp-doc h2, .rqp-doc h3 { font-family: var(--f-display); }
.rqp-pad { position: relative; border: 1.5px dashed var(--line-2); border-radius: 14px; background: #fff; overflow: hidden; }
.rqp-pad canvas { display: block; width: 100%; height: auto; aspect-ratio: 640 / 240; touch-action: none; cursor: crosshair; }
.rqp-pad__clear { position: absolute; inset-inline-end: 10px; top: 10px; min-height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--stone); color: var(--ink-2); font: 500 .875rem var(--f-body); cursor: pointer; }
.rqp-pad__clear:hover { background: var(--copper-soft); }
.rqp-signed { display: grid; gap: 4px; margin-bottom: 14px; }
.rqp-signed img { width: min(100%, 320px); border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.rqp-signed p { margin: 0; }

/* print view */
.rqp--print { background: #fff; }
.rqp-print { max-width: 780px; margin: 0 auto; padding: 32px 20px 64px; }
.rqp-print header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
@media print { .rqp-noprint { display: none !important; } body.rqp { background: #fff; } }

/* phones: the navigation becomes a tab bar at the bottom */
@media (max-width: 899px) {
  .rqp-layout { grid-template-columns: 1fr; padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .rqp-nav { position: fixed; z-index: 30; inset: auto 0 0 0; top: auto; grid-template-columns: repeat(5, 1fr); gap: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--stone-2); border-top: 1px solid var(--line); }
  .rqp-nav a { flex-direction: column; justify-content: center; gap: 2px; min-height: 58px; padding: 4px 2px; font-size: .6875rem; text-align: center; border-radius: 12px; }
  .rqp-nav a span { line-height: 1.3; }
  .rqp-user { display: none; }
  .rqp-top .rqp-brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .rqp-auth__art .rqp-mark path { stroke-dashoffset: 0 !important; }
}

/* night: the same stone, ink and copper after sunset, when the device asks for dark */
.rqp-logo-d { display: none; }
@media (prefers-color-scheme: dark) {
  :root {
    --stone: #111216; --stone-2: #17191E; --paper: #1A1C22; --ink: #EEE7DB; --ink-2: #C8C0B3; --grey: #9C9387;
    --line: rgba(238, 231, 219, .1); --line-2: rgba(238, 231, 219, .2);
    --copper: #CD8A5C; --copper-2: #DFA174; --copper-soft: rgba(205, 138, 92, .14); --patina: #88B8AA; --patina-soft: rgba(136, 184, 170, .14);
    --danger: #E07A62; --panel: #08090B; --panel-fg: #E9E2D6; --panel-accent: #E5AB80; --glow: #1B1C21;
    color-scheme: dark;
  }
  .rqp-logo-l { display: none; }
  .rqp-logo-d { display: inline-block; }
  .rqp-btn { color: #17191E; }
  .rqp-btn:hover { color: #17191E; }
  .rqp-btn--ghost, .rqp-btn--ghost:hover { color: var(--ink); }
  .rqp-nav a[aria-current="page"] { background: var(--copper); color: #17191E; }
  .rqp-flash--ok { color: #A9D3C6; }
  .rqp-tag--active, .rqp-tag--done { color: #A9D3C6; }
  .rqp-tag--trial, .rqp-tag--doing, .rqp-tag--setup, .rqp-tag--due, .rqp-tag--new { background: var(--copper-soft); color: var(--copper-2); }
  .rqp-pad, .rqp-signed img { background: #fff; }
  .rqp-pad__clear { background: #EFE8DD; color: #3A3F4A; }
}
