/* RuleFirm: sign-in and registration screens.
   Used by the office app (after app.css, which sets the tokens and the user's look)
   and by the main-site register/login pages (no app.css there: the default blue look below, following the device dark setting). */
:root:not([data-mode]) {
  color-scheme: light;
  --bg: #F3F6FA; --surface: #FFFFFF; --surface-2: #F7F9FC; --surface-3: #EEF3F9; --input-bg: #FFFFFF;
  --ink: #0F1B2D; --ink-2: #3B4A61; --muted: #6B7A90; --line: #E2E8F0; --line-2: #EDF1F6; --line-strong: #C9D3E1;
  --accent: #0B5CD5; --accent-hover: #0A4FB8; --accent-ink: #0A4FB8; --accent-soft: #E8F1FD; --on-accent: #FFFFFF; --bright: #3BA0FF;
  --menu-1: #071A3A; --menu-2: #0A3A7A; --menu-3: #0E5CC0; --menu-ink: #DCE6F5; --menu-muted: #93A6C4; --menu-line: rgba(255, 255, 255, .14); --menu-white: #FFFFFF;
  --red: #C8322B; --green: #16835A;
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
  --font: 'IBM Plex Sans Arabic', 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode]) {
    color-scheme: dark;
    --bg: #0A1220; --surface: #101B2C; --surface-2: #152236; --surface-3: #1A2840; --input-bg: #0D1726;
    --ink: #E7EEF8; --ink-2: #B3C0D3; --muted: #8293AB; --line: #22324A; --line-2: #1B2A3F; --line-strong: #33486A;
    --accent: #4C9BFF; --accent-hover: #6AAEFF; --accent-ink: #7DB6FF; --accent-soft: #13294A; --on-accent: #04101F; --bright: #4C9BFF;
    --menu-1: #060E1C; --menu-2: #0A1F44; --menu-3: #0D2C5E;
    --red: #FF8A80; --green: #4ADE9B;
    --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  }
}
:root {
  --ra-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='1'%3E%3Crect x='16' y='16' width='32' height='32'/%3E%3Crect x='16' y='16' width='32' height='32' transform='rotate(45 32 32)'/%3E%3Cpath d='M0 0l16 16M64 0L48 16M0 64l16-16M64 64L48 48M32 0v9.4M32 64v-9.4M0 32h9.4M64 32h-9.4'/%3E%3C/g%3E%3C/svg%3E");
}
.ra-page { margin: 0; background: var(--surface); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
.ra-page *, .ra-page *::before, .ra-page *::after { box-sizing: border-box; }
.ra-page [hidden] { display: none !important; }

.ra { width: 100%; min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(480px, 640px); background: var(--surface); color: var(--ink); }

/* Art panel: the same deep gradient as the office side menu */
.ra-art { position: sticky; top: 0; height: 100vh; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; padding: 48px 56px;
  background: linear-gradient(160deg, var(--menu-1) 0%, var(--menu-2) 58%, var(--menu-3) 100%); color: var(--menu-white); }
.ra-art::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--ra-pattern); background-size: 72px; opacity: .07;
  -webkit-mask-image: radial-gradient(circle at 80% 15%, var(--ink), transparent 75%); mask-image: radial-gradient(circle at 80% 15%, var(--ink), transparent 75%); }
.ra-art::after { content: ''; position: absolute; z-index: -1; width: 60%; aspect-ratio: 1; inset-inline-start: -15%; bottom: -25%; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--bright) 45%, transparent), transparent 70%); filter: blur(20px); animation: ra-glow 9s ease-in-out infinite alternate; }
@keyframes ra-glow { to { transform: translate(-8%, -6%) scale(1.1); } }
.ra-brand { display: flex; align-items: center; gap: 12px; color: var(--menu-white); text-decoration: none; font-weight: 700; font-size: 20px; }
.ra-brand img { width: 40px; height: 40px; border-radius: 10px; }
.ra-art-body { margin-top: auto; max-width: 620px; animation: ra-rise .7s var(--ease) both .1s; }
.ra-maxim { margin: 0; font-weight: 700; font-size: clamp(36px, 4.4vw, 60px); line-height: 1.2; letter-spacing: -.5px; }
.ra-art-text { margin: 18px 0 0; color: var(--menu-ink); font-size: 17px; max-width: 40ch; }
.ra-steps { margin: 28px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; color: var(--menu-ink); counter-reset: ra; }
.ra-steps li { display: flex; gap: 12px; align-items: baseline; counter-increment: ra; }
.ra-steps li::before { content: counter(ra); flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--menu-line); background: var(--menu-line);
  color: var(--menu-white); display: grid; place-items: center; font-size: 14px; font-weight: 700; }
@keyframes ra-rise { from { opacity: 0; transform: translateY(16px); } }

/* Form side */
.ra-side { display: flex; flex-direction: column; justify-content: center; padding: 48px 56px; background: var(--surface); }
.ra-card { width: 100%; max-width: 440px; margin: 0 auto; animation: ra-rise .5s var(--ease) both; }
.ra-card h1 { margin: 0; font-size: 30px; line-height: 1.3; font-weight: 700; color: var(--ink); }
.ra-lead { margin: 8px 0 0; color: var(--muted); font-size: 16px; }
.ra-form { display: flex; flex-direction: column; gap: 18px; margin-top: 28px; }
.ra-group { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.ra-group + .ra-group { border-top: 1px solid var(--line); padding-top: 22px; }
.ra-group legend { padding: 0; margin-bottom: 14px; font-size: 15px; font-weight: 700; color: var(--ink-2); }
.ra-field { display: flex; flex-direction: column; gap: 6px; }
.ra-field > span:first-child { font-size: 15px; font-weight: 600; color: var(--ink); }
.ra-hint { font-size: 14px; color: var(--muted); }
.ra-page .ra-field input, .ra-card .auth-form input:not([type=checkbox]) {
  width: 100%; height: 50px; padding: 0 16px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--input-bg); border: 1.5px solid var(--line); border-radius: 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.ra-page .ra-field input:hover, .ra-card .auth-form input:not([type=checkbox]):hover { border-color: var(--line-strong); }
.ra-page .ra-field input:focus, .ra-card .auth-form input:not([type=checkbox]):focus { border-color: var(--accent); box-shadow: var(--ring); }
.ra-page .ra-field input[aria-invalid=true] { border-color: var(--red); }
.ra-page .ra-field input[dir=ltr], .ra-card .auth-form input[dir=ltr] { text-align: left; }

/* Password with show/hide */
.ra-pass { position: relative; display: block; }
.ra-pass > input, .ra-page .ra-pass > input { padding-inline-end: 52px; }
.ra-eye { position: absolute; inset-block: 0; inset-inline-end: 4px; margin: auto 0; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.ra-eye:hover { color: var(--ink); background: var(--surface-3); }
.ra-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ra-eye svg { width: 22px; height: 22px; }
.ra-eye .ra-eye-off, .ra-eye[aria-pressed=true] .ra-eye-on { display: none; }
.ra-eye[aria-pressed=true] .ra-eye-off { display: block; }

/* Screens of the office app (login, setup, two-factor) inside the shared card */
.ra-card .auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.ra-card .auth-form > label:not(.check) { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; color: var(--ink); }
.ra-card .auth-note { margin: 16px 0 0; color: var(--muted); font-size: 15px; }
.ra-card .auth-err { margin: 0; min-height: 1.4em; color: var(--red); font-size: 15px; }
.ra-card .btn { height: 50px; justify-content: center; border-radius: 999px; font-size: 15px; }
.ra-card .btn.primary { height: 52px; font-size: 17px; font-weight: 700; }
.ra-card .check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.ra-office { margin: 10px 0 0; }

.ra-slug { display: flex; direction: ltr; align-items: stretch; border: 1.5px solid var(--line); border-radius: 12px; background: var(--input-bg); overflow: hidden; }
.ra-slug:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.ra-page .ra-slug input { border: 0; border-radius: 0; box-shadow: none !important; min-width: 0; flex: 1; }
.ra-slug code { display: flex; align-items: center; padding: 0 14px; background: var(--surface-2); color: var(--muted); font: inherit; font-size: 15px; border-inline-start: 1px solid var(--line); white-space: nowrap; }
.ra-addr { display: inline-flex; align-items: center; gap: 2px; direction: ltr; unicode-bidi: isolate; max-width: 100%; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 15px; overflow-wrap: anywhere; }
.ra-addr b { color: var(--ink); font-weight: 700; }
.ra-status { font-size: 14px; min-height: 1.4em; color: var(--muted); }
.ra-status.ok { color: var(--green); }
.ra-status.bad { color: var(--red); }
.ra-code-row { display: flex; gap: 10px; align-items: end; }
.ra-code-row .ra-field { flex: 1; }

/* Buttons */
.ra-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 52px; padding: 0 24px; border-radius: 999px; border: 1.5px solid transparent;
  font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; }
.ra-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.ra-btn:active { transform: translateY(1px); }
.ra-btn.primary { width: 100%; background: var(--accent); color: var(--on-accent); box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--accent) 80%, transparent); }
.ra-btn.primary:hover { background: var(--accent-hover); }
.ra-btn.primary:disabled { opacity: .55; cursor: not-allowed; }
.ra-btn.ghost { height: 50px; background: var(--surface); color: var(--ink); border-color: var(--line); font-size: 15px; font-weight: 600; }
.ra-btn.ghost:hover { border-color: var(--line-strong); background: var(--surface-2); }
.ra-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-ink); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ra-link:hover { color: var(--ink); }

.ra-err { margin: 0; min-height: 1.4em; color: var(--red); font-size: 15px; }
.ra-alt { margin: 24px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 15px; }
.ra-alt a { color: var(--accent-ink); font-weight: 700; }
.ra-check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.ra-check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

@media (max-width: 900px) {
  .ra { grid-template-columns: 1fr; }
  .ra-art { padding: 24px; position: static; height: auto; }
  .ra-art-body { margin-top: 24px; }
  .ra-maxim { font-size: 30px; }
  .ra-art-text { font-size: 15px; margin-top: 8px; }
  .ra-steps { display: none; }
  .ra-side { padding: 28px 20px 40px; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .ra-page *, .ra-page *::before, .ra-page *::after, .ra *, .ra *::after { transition: none !important; animation: none !important; } }
@media print {
  .ra-art, .ra-btn, .ra-alt { display: none !important; }
  .ra { display: block; }
  .ra-side { padding: 0; }
}
