/* Ramz web — same palette, shapes and motion as the Android apps. */

@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Thmanyah Serif Display"; src: url("fonts/thmanyahserifdisplay-Black.woff2") format("woff2"); font-weight: 900; font-display: swap; }

:root {
  --primary: #2456f5; --on-primary: #ffffff;
  --primary-c: #e3eaff; --on-primary-c: #0a2a8f;
  --bg: #f5f7fe; --surface: #ffffff; --surface-v: #eef2fd; --page: #ffffff;
  --ink: #0b1430; --muted: #59647f; --line: #d3daee; --line-2: #e4e9f6;
  --error: #d62f3c; --error-c: #ffe4e6; --ok: #14915a; --warn: #b86a00;
  --scrim: rgba(5, 10, 26, .45);
  --font: "Thmanyah Sans", -apple-system, "SF Arabic", "Geeza Pro", "Segoe UI", Tahoma, sans-serif;
  --display: "Thmanyah Serif Display", "Thmanyah Sans", -apple-system, "SF Arabic", "Geeza Pro", Tahoma, serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #6e8dff; --on-primary: #03113f; --primary-c: #16275f; --on-primary-c: #dce4ff;
    --bg: #04060c; --surface: #0b0f1a; --surface-v: #131a2b; --page: #0b0f1a;
    --ink: #e9edf8; --muted: #98a2bf; --line: #243049; --line-2: #1a2236;
    --error: #ff6b75; --error-c: #3a0f16; --ok: #4cd49a; --warn: #ffb648; --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --primary: #6e8dff; --on-primary: #03113f; --primary-c: #16275f; --on-primary-c: #dce4ff;
  --bg: #04060c; --surface: #0b0f1a; --surface-v: #131a2b; --page: #0b0f1a;
  --ink: #e9edf8; --muted: #98a2bf; --line: #243049; --line-2: #1a2236;
  --error: #ff6b75; --error-c: #3a0f16; --ok: #4cd49a; --warn: #ffb648; --scrim: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--font); font-size: 15px; line-height: 1.6; min-height: 100dvh; -webkit-font-smoothing: antialiased; }
body.noscroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; text-wrap: balance; }

.ms { font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 22px; line-height: 1;
  display: inline-block; direction: ltr; -webkit-font-feature-settings: "liga"; font-feature-settings: "liga"; user-select: none;
  font-variation-settings: "FILL" 0, "wght" 450, "GRAD" 0, "opsz" 24; }

.wrap { max-width: 720px; margin: 0 auto; padding: calc(var(--safe-top) + 12px) max(18px, env(safe-area-inset-right)) calc(var(--safe-bottom) + 120px) max(18px, env(safe-area-inset-left)); }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.grow { flex: 1; }
.col { display: flex; flex-direction: column; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- motion ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { transition: none; opacity: 1; transform: none; } }
.press { transition: transform .18s var(--ease); }
.press:active { transform: scale(.96); }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 6px 0 14px; }
.topbar .t { flex: 1; min-width: 0; }
.topbar h1 { font-size: 20px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { font-size: 12px; color: var(--muted); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; display: inline-grid; place-items: center;
  background: var(--surface-v); color: var(--ink); cursor: pointer; flex: none; transition: transform .18s var(--ease); }
.icon-btn:active { transform: scale(.9); }
.icon-btn.primary { background: var(--primary); color: var(--on-primary); width: 54px; height: 54px; }
.icon-btn.danger { color: var(--error); }
.icon-btn .ms { font-size: 22px; }
.back .ms { transform: scaleX(-1); }

/* ---------- buttons ---------- */
.btn { height: 54px; border-radius: 18px; border: 0; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center;
  gap: 10px; font-weight: 700; font-size: 16px; cursor: pointer; transition: transform .18s var(--ease), opacity .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.soft { background: var(--surface-v); color: var(--ink); }
.btn.danger { background: var(--error-c); color: var(--error); }
.btn.danger-solid { background: var(--error); color: #fff; }
.btn.block { width: 100%; }
.btn .spin { width: 20px; height: 20px; border: 2.5px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 500; color: var(--muted); }
.input { width: 100%; min-height: 52px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
  padding: 12px 14px; font-size: 16px; outline: none; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
textarea.input { resize: vertical; min-height: 96px; }
.ltr { direction: ltr; text-align: right; }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-v); border-radius: 14px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 10px; padding: 10px 6px; color: var(--muted); font-weight: 500; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--primary); }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(-20px); }
input[type="range"] { width: 100%; accent-color: var(--primary); }
.err { color: var(--error); background: color-mix(in srgb, var(--error-c) 70%, transparent); border-radius: 12px; padding: 12px; font-size: 14px; }

/* ---------- cards / groups ---------- */
.card { background: var(--surface); border-radius: 26px; padding: 18px; }
.card h2 { font-size: 17px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.card h2 .ms { color: var(--primary); }
.tile-icon { width: 44px; height: 44px; border-radius: 14px; background: var(--primary-c); color: var(--primary); display: grid; place-items: center; flex: none; }
.linkrow { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: 26px; padding: 16px 18px; cursor: pointer; border: 0; width: 100%; text-align: start; }
.linkrow .ms.chev { color: var(--muted); }

/* ---------- logo ---------- */
.logo-tile { background: var(--primary); display: grid; place-items: center; flex: none; }
.logo-tile svg { width: 86%; height: 86%; }

/* ---------- list ---------- */
.hero-title { font-family: var(--display); font-weight: 900; font-size: 34px; line-height: 1.25; }
.search { flex: 1; display: flex; align-items: center; gap: 10px; height: 54px; border-radius: 18px; background: var(--surface); padding: 0 14px; }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; min-width: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.chips button { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 99px; padding: 8px 18px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.chips button.on { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.codecard { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: 24px; padding: 12px; cursor: pointer; border: 0; width: 100%; text-align: start; }
.codecard .thumb { width: 68px; height: 68px; border-radius: 16px; background: #fff; padding: 6px; flex: none; display: grid; place-items: center; }
.codecard .thumb canvas { max-width: 100%; max-height: 100%; }
.codecard .nm { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.codecard .pv { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kind { display: inline-block; font-size: 11px; font-weight: 500; background: var(--primary-c); color: var(--on-primary-c); border-radius: 99px; padding: 2px 9px; }
.fab { position: fixed; inset-inline-start: max(20px, env(safe-area-inset-right)); bottom: calc(var(--safe-bottom) + 20px); z-index: 5;
  height: 60px; padding: 0 22px; border-radius: 22px; border: 0; background: var(--primary); color: var(--on-primary);
  font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; cursor: pointer;
  box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--primary) 70%, transparent); transition: transform .18s var(--ease); }
.fab:active { transform: scale(.95); }
.empty { text-align: center; padding: 40px 24px; }
.empty .big { width: 84px; height: 84px; border-radius: 28px; margin: 0 auto 18px; background: var(--primary-c); color: var(--primary); display: grid; place-items: center; }
.empty .big .ms { font-size: 40px; }
.empty h3 { font-size: 20px; }

/* ---------- the code page ---------- */
.page { background: var(--page); display: flex; flex-direction: column; gap: 14px; }
.logo-row { display: flex; justify-content: flex-start; margin-bottom: 6px; }
.logo-row.end { justify-content: flex-end; }
.logo-img { object-fit: contain; }
.prow { display: block; }
.prow.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
.prow.pair .blk, .prow.pair .box { height: 100%; }
.blk { position: relative; }
.blk.editable { border: 1.4px dashed var(--line); border-radius: 16px; padding: 6px; cursor: pointer; }
.blk.editable.selected { border: 2px solid var(--primary); }
.box { display: flex; flex-direction: column; gap: 4px; }
.box.plain { padding: 2px 4px; }
.box.card { background: var(--surface-v); border-radius: 18px; padding: 16px; }
.box.highlight { background: var(--primary); color: var(--on-primary); border-radius: 22px; padding: 18px; }
.box.a-start { text-align: start; align-items: flex-start; }
.box.a-center { text-align: center; align-items: center; }
.box.a-end { text-align: end; align-items: flex-end; }
.blk-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.box.highlight .blk-label { color: color-mix(in srgb, var(--on-primary) 78%, transparent); }
.blk-text { line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; width: 100%; }
.blk-text.title { font-family: var(--display); }
.blk-text.oneline { white-space: nowrap; overflow: hidden; }
.blk-hint { font-size: 14px; color: var(--muted); opacity: .7; }
.blk-img { width: 100%; object-fit: cover; background: var(--surface-v); border-radius: 18px; }
.blk-img.round { border-radius: 24px; }
.blk-img.ph { display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.divider { border: 0; height: 1px; background: var(--line); margin: 8px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; width: max-content; }
.chip i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.chip.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.chip.bad { color: var(--error); background: color-mix(in srgb, var(--error) 14%, transparent); }

/* full-screen page view with the fading close bar */
.pageview { position: fixed; inset: 0; z-index: 30; background: var(--page); overflow-y: auto;
  padding: calc(var(--safe-top) + 22px) 22px calc(var(--safe-bottom) + 130px); animation: rise .55s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6%) scale(.97); } to { opacity: 1; transform: none; } }
.pageview .page { max-width: 640px; margin: 0 auto; }
.closebar { position: fixed; inset-inline: 0; bottom: 0; z-index: 31; padding: 36px 20px calc(var(--safe-bottom) + 16px);
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--page) 92%, transparent) 35%, var(--page)); }
.closebar .btn { width: 100%; max-width: 640px; margin: 0 auto; display: flex; }

/* ---------- editor ---------- */
.phone { border: 1px solid var(--line-2); border-radius: 30px; background: var(--page); padding: 18px; }
.phone .page { gap: 12px; }
.add-info { width: 100%; height: 64px; border-radius: 22px; border: 1.5px solid color-mix(in srgb, var(--primary) 35%, transparent);
  background: var(--primary-c); color: var(--on-primary-c); font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 12px; cursor: pointer; }
.add-info .ms { background: var(--primary); color: var(--on-primary); border-radius: 11px; padding: 6px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.typebtn { border: 0; background: var(--surface-v); border-radius: 20px; padding: 16px 6px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 500; }
.typebtn .ms { background: var(--primary-c); color: var(--primary); border-radius: 13px; padding: 10px; }
.bottom-action { position: fixed; inset-inline: 0; bottom: 0; z-index: 6; padding: 12px max(20px, env(safe-area-inset-right)) calc(var(--safe-bottom) + 12px);
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.bottom-action .btn { width: 100%; max-width: 680px; margin: 0 auto; display: flex; }

/* ---------- detail ---------- */
.code-hero { background: var(--surface); border: 1px solid var(--line-2); border-radius: 32px; padding: 22px; text-align: center; }
.code-hero .art { background: #fff; border-radius: 24px; padding: 14px; margin: 0 auto 16px; width: 80%; aspect-ratio: 1; display: grid; place-items: center; }
.code-hero .art.wide { width: 100%; aspect-ratio: 2.2; }
.code-hero .art canvas { width: 100%; height: 100%; object-fit: contain; animation: pop .6s var(--ease); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.action { border: 1px solid var(--line-2); background: var(--surface); border-radius: 20px; padding: 16px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; transition: transform .18s var(--ease); }
.action:active { transform: scale(.95); }
.action .ms { background: var(--primary-c); color: var(--primary); border-radius: 14px; padding: 11px; }
.action.danger { color: var(--error); }
.action.danger .ms { background: var(--error-c); color: var(--error); }

/* ---------- sheet / modal / toast ---------- */
.sheet-back, .modal-back { position: fixed; inset: 0; z-index: 50; background: var(--scrim); opacity: 0; transition: opacity .25s; }
.sheet-back.open, .modal-back.open { opacity: 1; }
.sheet { position: absolute; inset-inline: 0; bottom: 0; max-height: 92dvh; overflow-y: auto; background: var(--surface);
  border-radius: 28px 28px 0 0; padding: 10px 20px calc(var(--safe-bottom) + 20px); transform: translateY(100%); transition: transform .32s var(--ease); }
.sheet-back.open .sheet { transform: none; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 6px auto 14px; }
.sheet-title { font-size: 22px; font-weight: 700; margin-bottom: 14px; }
.sheet .body { display: flex; flex-direction: column; gap: 14px; max-width: 680px; margin: 0 auto; }
.modal-back { display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 28px; padding: 24px; width: min(420px, 100%); text-align: center; transform: scale(.94); transition: transform .25s var(--ease); }
.modal-back.open .modal { transform: none; }
.modal h3 { font-size: 20px; margin-bottom: 8px; }
.modal p { color: var(--muted); margin: 0 0 20px; }
.modal-icon { color: var(--primary); font-size: 32px !important; margin-bottom: 8px; }
.modal-icon.danger { color: var(--error); }
.toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 96px); z-index: 70; transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 14px; font-size: 14px; max-width: calc(100% - 32px); text-align: center;
  transition: opacity .25s, transform .3s var(--ease); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- scanner ---------- */
.scanner { position: fixed; inset: 0; background: #000; overflow: hidden; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; left: 50%; top: 42%; width: min(70vw, 340px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 30px; box-shadow: 0 0 0 200vmax rgba(3, 6, 15, .8); animation: breathe 2.8s ease-in-out infinite; }
@keyframes breathe { 50% { transform: translate(-50%, -50%) scale(1.03); } }
.scanner .frame i { position: absolute; width: 22%; height: 22%; border: 5px solid var(--primary); }
.scanner .frame i:nth-child(1) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 30px; }
.scanner .frame i:nth-child(2) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 30px; }
.scanner .frame i:nth-child(3) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 30px; }
.scanner .frame i:nth-child(4) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 30px; }
.scanner .frame.ok i { border-color: #4cd49a; }
.scanner .laser { position: absolute; inset-inline: 8%; height: 2.5px; top: 10%; border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent); animation: sweep 2s ease-in-out infinite alternate; }
@keyframes sweep { to { top: 88%; } }
@media (prefers-reduced-motion: reduce) { .scanner .laser, .scanner .frame { animation: none; } }
.scanner .top { position: absolute; top: calc(var(--safe-top) + 16px); inset-inline: 20px; display: flex; align-items: center; gap: 10px; color: #fff; }
.scanner .top .icon-btn { background: rgba(0, 0, 0, .4); color: #fff; }
.scanner .bottom { position: absolute; bottom: calc(var(--safe-bottom) + 28px); inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.scanner .hint { color: #fff; background: rgba(0, 0, 0, .45); border-radius: 99px; padding: 8px 18px; font-weight: 700; }
.stagebtn { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #fff; font-size: 13px; font-weight: 500; background: none; border: 0; cursor: pointer; }
.stagebtn .ms { width: 62px; height: 62px; border-radius: 50%; background: rgba(255, 255, 255, .16); display: grid; place-items: center; font-size: 28px; }
.scanner .nocam { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #fff; padding: 32px; }
.result-sheet { position: fixed; inset-inline: 0; bottom: 0; z-index: 40; background: var(--surface); border-radius: 32px 32px 0 0;
  padding: 26px 24px calc(var(--safe-bottom) + 24px); text-align: center; animation: up .42s var(--ease); }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.result-sheet .ico { width: 64px; height: 64px; border-radius: 22px; margin: 0 auto 14px; display: grid; place-items: center; }
.result-sheet .ico .ms { font-size: 34px; }
.result-sheet h3 { font-size: 22px; }
.result-sheet p { color: var(--muted); margin: 4px 0 22px; }

/* ---------- print just the label ---------- */
.print-area { display: none; }
@media print {
  body.printing > *:not(.print-area) { display: none !important; }
  body.printing .print-area { display: block; }
  .print-area img { width: 70mm; margin: 0 auto 8mm; break-inside: avoid; }
}
