/* Mega Ops. Brand: warm black + tabletop orange (from the logo). Fonts: IBM Plex Sans Arabic (text), Reem Kufi (display). */
:root {
  --ink: #131010; --ink-2: #2a2623; --orange: #f79a1e; --orange-d: #c97800;
  --stone: #efedea; --panel: #ffffff; --rule: #d9d5cf; --muted: #6b645c;
  --danger: #b3261e; --ok: #1f7a3d;
  --display: 'Reem Kufi', 'IBM Plex Sans Arabic', sans-serif;
  --text: 'IBM Plex Sans Arabic', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--stone); color: var(--ink); font-family: var(--text); font-size: 15px; line-height: 1.65; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ---------- chrome ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--ink); color: #fff; border-bottom: 3px solid var(--orange); }
.topbar .in { max-width: 820px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 8px 16px; }
.topbar img { width: 34px; height: 34px; border-radius: 4px; display: block; }
.topbar .brand { font-family: var(--display); font-size: 19px; font-weight: 700; flex: 1; letter-spacing: .2px; }
.topbar .who { font-size: 13px; color: #cfc9c2; }
.topbar button { background: transparent; border: 1px solid #4a443f; color: #fff; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.topbar button:hover { border-color: var(--orange); }
.nav { background: var(--panel); border-bottom: 1px solid var(--rule); }
.nav .in { max-width: 820px; margin: 0 auto; display: flex; gap: 4px; padding: 0 12px; overflow-x: auto; }
.nav a { white-space: nowrap; padding: 12px 12px 10px; text-decoration: none; font-weight: 500; font-size: 14.5px; color: var(--muted); border-bottom: 3px solid transparent; }
.nav a.on { color: var(--ink); border-bottom-color: var(--orange); font-weight: 600; }
main { max-width: 820px; margin: 0 auto; padding: 18px 16px 120px; }
.pagehead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 4px 0 16px; }
h1 { font-family: var(--display); font-size: 25px; line-height: 1.35; margin: 0; font-weight: 500; }
h2 { font-size: 16px; margin: 0; font-weight: 600; }

/* ---------- panels and forms ---------- */
.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; margin-bottom: 14px; }
.panel > .ph { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.panel > .pb { padding: 16px; }
.step { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; flex: none; }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid.c2 { grid-template-columns: 1fr 1fr; } .grid.c3 { grid-template-columns: 1fr 1fr 1fr; } }
.f { display: block; }
.f > span { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=tel], input[type=date], input[type=password], select, textarea {
  width: 100%; min-height: 46px; padding: 9px 12px; border: 1px solid #c9c4bd; border-radius: 6px; background: #fff;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: 2px solid var(--orange); outline-offset: 0; }
input:disabled { background: #f3f1ee; color: #a29b93; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 6px; border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; text-decoration: none; font-weight: 600; }
.btn:hover { background: var(--ink-2); }
.btn.accent { background: var(--orange); border-color: var(--orange); color: var(--ink); }
.btn.accent:hover { background: #ffab3d; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: #f3f1ee; }
.btn.danger { background: transparent; color: var(--danger); border-color: #e2b9b5; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* add-room tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(6, 1fr); } }
.tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px 10px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; font-weight: 500; line-height: 1.3; text-align: center; }
.tile:hover { border-color: var(--ink); background: #faf9f7; }
.tile:active { background: #f3f1ee; }
.tile svg, .ico { width: 28px; height: 28px; stroke: var(--ink); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* room panels */
.room .ph { background: #faf9f7; border-radius: 6px 6px 0 0; }
.room .ph h2 { font-family: var(--display); font-size: 19px; font-weight: 500; flex: 1; }
.room .ph .ico { width: 24px; height: 24px; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--danger); border-color: #e2b9b5; }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.sub { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 8px; }
.fixed { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #faf9f7; border: 1px solid var(--rule); border-radius: 6px; margin-bottom: 14px; font-size: 14px; }
.fixed b { font-weight: 600; }
.woods { display: grid; gap: 8px; }
.wood { display: grid; grid-template-columns: 24px 1fr minmax(120px, 150px); gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--rule); border-radius: 6px; background: #fff; cursor: pointer; }
.wood.on { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--orange); background: #fffaf2; }
.wood input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--ink); margin: 0; }
.wood .wn { font-weight: 500; }
.money { position: relative; }
.money input { padding: 8px 12px 8px 46px; text-align: right; direction: ltr; min-height: 40px; }
.money em { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12px; color: var(--muted); pointer-events: none; }

/* photos */
.drop { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; border: 1.5px dashed #b9b3ab; border-radius: 6px; background: #fff; cursor: pointer; font-weight: 500; }
.drop:hover { border-color: var(--ink); background: #faf9f7; }
.drop svg { width: 22px; height: 22px; stroke: var(--ink); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 12px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; border: 1px solid var(--rule); background: #f3f1ee; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 4px; inset-inline-start: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(19,16,16,.78); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; }
.hint { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* sticky total + save */
.savebar { position: fixed; inset-inline: 0; bottom: 0; z-index: 15; background: var(--ink); color: #fff; border-top: 3px solid var(--orange); }
.savebar .in { max-width: 820px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.savebar .tot { flex: 1; min-width: 0; }
.savebar .tot small { display: block; font-size: 12px; color: #bdb6ae; line-height: 1.3; }
.savebar .tot b { font-size: 20px; font-weight: 700; line-height: 1.3; }
.savebar .btn.ghost { color: #fff; border-color: #4a443f; }
.savebar .btn.ghost:hover { background: #2a2623; }

/* ---------- list ---------- */
.qrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 14px 16px; text-decoration: none; border-bottom: 1px solid var(--rule); background: var(--panel); }
.qrow:first-child { border-radius: 6px 6px 0 0; }
.qrow:last-child { border-bottom: 0; border-radius: 0 0 6px 6px; }
.qrow:only-child { border-radius: 6px; }
.qrow:hover { background: #faf9f7; }
.qrow .nm { font-weight: 600; font-size: 16px; }
.qrow .amt { font-weight: 700; font-size: 16px; text-align: left; direction: ltr; }
.qrow .meta { grid-column: 1 / -1; display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.qrow .no { font-weight: 600; color: var(--ink); }
.list { border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; background: var(--panel); }
.list .qrow { border-radius: 0 !important; }
.empty { text-align: center; padding: 44px 16px; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

.msg { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; border: 1px solid; font-size: 14px; }
.msg.err { background: #fdf0ee; color: var(--danger); border-color: #efc4bf; }
.msg.ok { background: #edf7f0; color: var(--ok); border-color: #bfdfc9; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; background: var(--panel); }
.login .brandside { background: var(--ink); color: #fff; padding: 36px 24px 28px; border-bottom: 4px solid var(--orange); text-align: center; }
.login .brandside img { width: 88px; height: 88px; border-radius: 6px; }
.login .brandside h1 { margin-top: 12px; font-size: 28px; }
.login .brandside p { margin: 4px 0 0; color: #bdb6ae; font-size: 14px; }
.login .formside { padding: 28px 20px; max-width: 400px; width: 100%; margin: 0 auto; }
@media (min-width: 820px) {
  .login { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
  .login .brandside { display: flex; flex-direction: column; justify-content: center; align-items: center; border-bottom: 0; border-inline-end: 6px solid var(--orange); }
  .login .formside { align-self: center; }
}

/* users */
.urow { display: grid; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.urow:last-child { border-bottom: 0; }
.urow .t { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.urow .t span:last-child { font-weight: 500; font-size: 13px; color: var(--muted); }
.urow .a { display: flex; gap: 8px; flex-wrap: wrap; }
.urow .a input { flex: 1; min-width: 150px; min-height: 36px; }

/* ---------- document preview ---------- */
.docbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.docbar .btn.accent { flex: 1; min-width: 180px; }
.pv { position: relative; margin: 0 auto 14px; background: #fff; box-shadow: 0 1px 2px rgba(19,16,16,.12), 0 8px 24px rgba(19,16,16,.10); overflow: hidden; }
.pv .page { position: absolute; top: 0; right: 0; transform-origin: top right; }

/* ---------- the quotation page (A4 at 794 x 1122 css px; this is what becomes the PDF) ---------- */
.page { width: 794px; height: 1122px; background: #fff; color: var(--ink); font-family: var(--text); direction: rtl; position: relative; overflow: hidden; font-size: 14px; line-height: 1.6; }
.page * { box-sizing: border-box; }
.page .bar { height: 8px; background: var(--orange); }
.page .hd { position: absolute; top: 8px; right: 0; left: 0; height: 92px; padding: 0 44px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rule); }
.page .hd .id { display: flex; align-items: center; gap: 12px; }
.page .hd img { width: 54px; height: 54px; display: block; }
.page .hd .nm { font-family: var(--display); font-weight: 700; font-size: 21px; line-height: 1.2; }
.page .hd .nm small { display: block; font-family: var(--text); font-weight: 400; font-size: 12px; color: var(--muted); }
.page .hd .qn { text-align: left; direction: ltr; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.page .hd .qn b { display: block; color: var(--ink); font-size: 15px; font-weight: 700; }
.page .bd { position: absolute; top: 122px; bottom: 66px; right: 44px; left: 44px; overflow: hidden; }
.page .ft { position: absolute; bottom: 0; right: 0; left: 0; height: 50px; padding: 0 44px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--rule); font-size: 12px; color: var(--muted); }

.page .title { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.page .title h2 { font-family: var(--display); font-size: 46px; line-height: 1.1; font-weight: 500; margin: 0; }
.page .title .tab { width: 64px; height: 12px; background: var(--orange); border-radius: 2px; margin-bottom: 10px; }
.page .meta { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); margin-bottom: 22px; }
.page .meta div { padding: 9px 0 9px 10px; }
.page .meta dt { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.page .meta dd { margin: 0; font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.page .meta dd.ltr { direction: ltr; text-align: right; }

.page .rb { margin-bottom: 20px; }
.page .rb .rh { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--ink); margin-bottom: 10px; }
.page .rb .rh .tab { width: 30px; height: 5px; background: var(--orange); border-radius: 1px; margin-bottom: 7px; }
.page .rb h3 { font-family: var(--display); font-size: 23px; line-height: 1.25; font-weight: 500; margin: 0; }
.page .rb .rp { font-family: var(--display); font-size: 21px; font-weight: 700; direction: ltr; white-space: nowrap; }
.page .rb .rp small { font-family: var(--text); font-size: 12px; font-weight: 500; color: var(--muted); margin-inline-start: 4px; }
.page .specs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; margin: 0; }
.page .specs > div { display: flex; flex-direction: column; padding: 6px 0; border-bottom: 1px solid #ece9e4; }
.page .specs > div.w { grid-column: 1 / -1; }
.page .specs dt { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.page .specs dd { margin: 0; font-size: 14.5px; font-weight: 500; white-space: pre-wrap; }
.page .woodgrid { display: grid; gap: 10px; margin-top: 12px; }
.page .wc { border: 1px solid var(--rule); border-top: 4px solid var(--ink); padding: 8px 12px 10px; }
.page .wc span { display: block; font-size: 12.5px; color: var(--muted); }
.page .wc b { display: block; font-size: 14.5px; font-weight: 600; margin-bottom: 4px; }
.page .wc strong { display: block; font-family: var(--display); font-size: 22px; font-weight: 700; direction: ltr; text-align: right; line-height: 1.2; }
.page .wcap { font-size: 12px; color: var(--muted); margin-top: 6px; }
.page .rnote { margin: 10px 0 0; padding: 8px 12px; background: #f6f4f1; border-radius: 3px; font-size: 13.5px; white-space: pre-wrap; }

.page .ph2 { margin: 0 0 12px; display: flex; align-items: flex-end; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--ink); }
.page .ph2 .tab { width: 30px; height: 5px; background: var(--orange); border-radius: 1px; margin-bottom: 7px; }
.page .ph2 h3 { font-family: var(--display); font-size: 23px; line-height: 1.25; font-weight: 500; margin: 0; }
.page .photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.page .photos figure { margin: 0; height: 300px; background: #f3f1ee; border: 1px solid var(--rule); display: grid; place-items: center; }
.page .photos img { max-width: 100%; max-height: 100%; display: block; }

.page .sum { margin-bottom: 20px; }
.page .sum table { width: 100%; border-collapse: collapse; }
.page .sum td { padding: 7px 0; border-bottom: 1px solid #ece9e4; font-size: 14.5px; }
.page .sum td:last-child { text-align: left; direction: ltr; font-weight: 600; white-space: nowrap; }
.page .grand { background: var(--ink); color: #fff; padding: 14px 18px; margin-top: 14px; border-radius: 3px; border-right: 8px solid var(--orange); }
.page .grand .gl { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 3px 0; }
.page .grand .gl span { font-size: 14px; color: #e6e0d8; }
.page .grand .gl b { font-family: var(--display); font-size: 26px; font-weight: 700; direction: ltr; white-space: nowrap; }
.page .grand .gl + .gl { border-top: 1px solid #3a3531; margin-top: 4px; padding-top: 8px; }
.page .grand .gl.one span { font-size: 16px; font-weight: 600; color: #fff; }
.page .grand .gl.one b { font-size: 32px; color: var(--orange); }

.page .terms { margin-bottom: 20px; }
.page .pbar { display: flex; height: 14px; border-radius: 2px; overflow: hidden; margin: 4px 0 10px; }
.page .pbar i { display: block; }
.page .pcols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.page .pcols div { border-top: 1px solid var(--rule); padding-top: 6px; }
.page .pcols strong { display: block; font-family: var(--display); font-size: 24px; line-height: 1.2; font-weight: 700; }
.page .pcols span { font-size: 13px; color: #3d3833; line-height: 1.5; display: block; }
.page .tx { margin: 14px 0 0; }
.page .tx dt { font-size: 12px; color: var(--muted); font-weight: 500; }
.page .tx dd { margin: 0 0 10px; font-size: 14.5px; white-space: pre-wrap; }
.page .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 38px; }
.page .sign div { border-top: 1px solid var(--ink); padding-top: 6px; font-size: 13px; color: var(--muted); }

.page .wc strong small, .page .grand .gl b small { font-family: var(--text); font-size: 12px; font-weight: 500; margin-inline-start: 5px; color: inherit; opacity: .75; }

/* ---------- cover page ---------- */
.page.cover .shade { position: absolute; top: 0; left: 0; width: 794px; height: 1122px; }
.page.cover .c-top { position: absolute; top: 0; left: 0; right: 0; height: 196px; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.page.cover .c-top img { width: 372px; display: block; }
.page.cover .c-strip { position: absolute; top: 196px; left: 0; right: 0; height: 38px; background: #e8e4df; display: flex; align-items: center; justify-content: space-between; padding: 0 56px; font-size: 13px; }
.page.cover .c-strip b { font-weight: 700; direction: ltr; unicode-bidi: isolate; display: inline-block; margin-right: 10px; }
.page.cover .c-title { position: absolute; top: 366px; left: 0; right: 0; margin: 0; text-align: center; direction: ltr; font-family: 'Michroma', sans-serif; font-weight: 400; font-size: 36px; line-height: 1.4; }
.page.cover .c-rule { position: absolute; top: 438px; left: 337px; width: 120px; height: 5px; border-radius: 3px; background: var(--orange); }
.page.cover .c-tag { position: absolute; top: 462px; left: 0; right: 0; margin: 0; text-align: center; font-family: var(--text); font-weight: 500; font-size: 23px; line-height: 1.7; color: #3d3733; }
.page.cover .c-card { position: absolute; top: 590px; left: 50px; right: 50px; min-height: 220px; display: grid; grid-template-columns: 1fr 1fr; background: #f7f6f4; border: 1px solid #e4e0da; border-radius: 14px; }
.page.cover .c-card .col { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 26px 34px; min-width: 0; }
.page.cover .c-card .col + .col { align-items: flex-end; }
.page.cover .c-card .col:first-child { border-left: 2px solid var(--ink); }
.page.cover .c-card .col > div { max-width: 100%; }
.page.cover .c-card .ci + .ci { margin-top: 22px; }
.page.cover .c-card small { display: block; font-size: 14px; color: #8d857d; font-weight: 500; }
.page.cover .c-card b { display: block; font-size: 21px; font-weight: 700; line-height: 1.6; overflow-wrap: anywhere; }
.page.cover .c-card b.ltr { direction: ltr; text-align: right; }
.page.cover .c-bottom { position: absolute; bottom: 0; left: 0; right: 0; height: 100px; background: var(--ink); display: flex; align-items: center; justify-content: center; }
.page.cover .c-bottom span { direction: ltr; color: #fff; font-family: 'Michroma', sans-serif; font-size: 15px; line-height: 1.6; }
