/* 26pdf — طاولة مكتب: أوراق بيضاء على سطح أخضر داكن هادئ، وملصق أصفر للرقم */
:root {
  --bg: #F3F5F4;
  --surface: #FFFFFF;
  --ink: #15221F;
  --muted: #5C6B67;
  --line: #DCE3E0;
  --accent: #0F5E59;
  --accent-ink: #FFFFFF;
  --accent-soft: #E1EEEC;
  --sticker: #F2C14E;
  --danger: #B3402E;
  --ok: #2F7D4F;
  --shadow: 0 1px 2px rgba(21,34,31,.06), 0 6px 18px rgba(21,34,31,.06);
  --font-display: "Readex Pro", "IBM Plex Sans Arabic", Tahoma, sans-serif;
  --font-body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101816; --surface: #17221F; --ink: #E6EEEB; --muted: #9AABA6;
    --line: #2A3935; --accent: #4FB3A9; --accent-ink: #0B1513; --accent-soft: #1D332F;
    --sticker: #E8B83F; --danger: #E07A66; --ok: #6CC08E;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101816; --surface: #17221F; --ink: #E6EEEB; --muted: #9AABA6;
  --line: #2A3935; --accent: #4FB3A9; --accent-ink: #0B1513; --accent-soft: #1D332F;
  --sticker: #E8B83F; --danger: #E07A66; --ok: #6CC08E;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.7;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.3; text-wrap: balance; margin: 0; }
:focus-visible { outline: 3px solid var(--sticker); outline-offset: 2px; border-radius: 6px; }

.wrap {
  max-width: 1080px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; direction: ltr; letter-spacing: -.01em; }
.brand-name b { color: var(--accent); font-weight: 700; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 8px; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }

/* Hero */
.hero .wrap { padding-block: 48px 28px; display: grid; gap: 14px; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); font-weight: 700; }
.hero h1 .mark { background: linear-gradient(transparent 62%, var(--sticker) 62%); padding: 0 4px; }
.hero p { color: var(--muted); max-width: 60ch; margin: 0; font-size: 1.08rem; }
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); padding: 4px 12px; border-radius: 999px; }
.badge svg { width: 15px; height: 15px; color: var(--ok); }

/* Tool cards */
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; padding-block: 8px 48px; }
.tool-card {
  display: grid; gap: 10px; align-content: start; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.tool-card .ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tool-card .ico svg { width: 24px; height: 24px; }
.tool-card h2 { font-size: 1.15rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .95rem; }
.tool-card.soon { opacity: .6; pointer-events: none; }
.tool-card .tag { justify-self: start; font-size: .75rem; background: var(--sticker); color: #2A2208; padding: 1px 8px; border-radius: 4px; letter-spacing: .02em; }
.section-title { font-size: 1.1rem; color: var(--muted); font-weight: 500; padding-top: 8px; }

/* Tool page */
.tool-head .wrap { padding-block: 36px 20px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.tool-head h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
.tool-head p { color: var(--muted); margin: 0; max-width: 56ch; }
.workspace { padding-block: 8px 40px; display: grid; gap: 18px; }

.drop {
  border: 2px dashed var(--line); border-radius: 14px; background: var(--surface);
  padding: 36px 20px; text-align: center; display: grid; gap: 12px; justify-items: center;
  transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 48px; height: 48px; color: var(--accent); }
.drop p { margin: 0; color: var(--muted); }
.drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 500;
  border: 0; border-radius: 10px; padding: 12px 26px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn.big { font-size: 1.15rem; padding: 14px 34px; }
.btn svg { width: 20px; height: 20px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 16px; }
.panel-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-top h2 { font-size: 1.05rem; }
.count { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }

/* image grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.item {
  position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; display: grid; gap: 8px; cursor: grab; user-select: none;
}
.item.dragging { opacity: .4; }
.item.drop-target { outline: 2px solid var(--accent); }
.thumb { aspect-ratio: 3 / 4; max-width: 100%; background: #fff; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.15); display: grid; place-items: center; overflow: hidden; }
.thumb img { max-height: 100%; object-fit: contain; }
.item .num { position: absolute; top: 6px; inset-inline-start: 6px; background: var(--sticker); color: #2A2208; font-size: .75rem; font-weight: 700; min-width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.item .name { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: center; }
.item-actions { display: flex; justify-content: center; gap: 4px; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn.del:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* pdf list */
.list { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: grab; }
.row.dragging { opacity: .4; }
.row.drop-target { outline: 2px solid var(--accent); }
.row .doc { width: 38px; height: 46px; flex: none; position: relative; background: #fff; border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.18); display: grid; place-items: end center; padding-bottom: 5px; font-size: .62rem; font-weight: 700; color: #B3402E; }
.row .info { flex: 1; min-width: 0; }
.row .fname { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: right; }
.row .meta { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.row .meta.err { color: var(--danger); }
.row .num { background: var(--sticker); color: #2A2208; font-size: .78rem; font-weight: 700; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; flex: none; }
.row .item-actions { flex: none; }

/* options */
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.opt { display: grid; gap: 6px; }
.opt > span { font-size: .9rem; font-weight: 500; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg label { flex: 1; text-align: center; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 6px; border-radius: 7px; font-size: .88rem; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--accent); font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.seg input:focus-visible + span { outline: 2px solid var(--sticker); }

.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.status { text-align: center; color: var(--muted); min-height: 1.5em; margin: 0; }
.status.err { color: var(--danger); }

.result { text-align: center; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 14px; padding: 28px 18px; display: grid; gap: 12px; justify-items: center; }
.result h2 { font-size: 1.3rem; }
.result p { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Content pages & how-to */
.prose { max-width: 68ch; margin: 0 auto; padding-block: 36px 56px; }
.prose h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin-bottom: 12px; }
.prose h2 { font-size: 1.2rem; margin-top: 28px; margin-bottom: 6px; }
.prose p, .prose li { color: var(--ink); }
.prose .lead { color: var(--muted); }
.howto { padding-block: 8px 48px; }
.howto h2 { font-size: 1.25rem; margin-bottom: 14px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; counter-reset: s; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 4px; }
.steps li::before { content: counter(s); font-family: var(--font-display); font-weight: 700; color: var(--accent); font-size: 1.4rem; }
.faq { display: grid; gap: 10px; margin-top: 24px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.faq summary { cursor: pointer; font-weight: 500; }
.faq p { margin: 8px 0 0; color: var(--muted); }
.copy-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.copy-line code { direction: ltr; font-size: 1rem; user-select: all; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer .wrap { padding-block: 24px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

@media (max-width: 560px) {
  .site-header .wrap { justify-content: center; }
  .row { flex-wrap: wrap; }
  .row .info { flex-basis: calc(100% - 90px); }
  .row .item-actions { width: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* أدوات الملف الواحد */
.file-bar { display: flex; align-items: center; gap: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.file-bar .doc { width: 38px; height: 46px; flex: none; background: #fff; border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.18); display: grid; place-items: end center; padding-bottom: 5px; font-size: .62rem; font-weight: 700; color: #B3402E; }
.file-bar .info { flex: 1; min-width: 0; }
.file-bar .fname { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: right; }
.file-bar .meta { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.btn.small { font-size: .9rem; padding: 7px 14px; }
.opt.wide { grid-column: 1 / -1; }
.opt > label { font-size: .9rem; font-weight: 500; }
.opt small { color: var(--muted); font-size: .82rem; }
.opt.check { align-content: end; }
.opt.check label { display: flex; gap: 8px; align-items: center; font-weight: 400; cursor: pointer; padding-block: 8px; }
.opt.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.text-input { width: 100%; font: inherit; font-size: 1rem; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.item.static { cursor: default; }
.item.removed .thumb { opacity: .3; }
.item.removed { border-color: var(--danger); border-style: dashed; }
.thumb img { transition: transform .2s ease; }
