/* فوج البناء والتطوير — الواجهة */
:root {
  --ground: #F1F2EE;
  --surface: #FFFFFF;
  --ink: #16211D;
  --muted: #5C6963;
  --soft: #E7EAE4;
  --line: #D8DDD5;
  --side: #10261F;
  --side-2: #183830;
  --side-ink: #DCE7E1;
  --ok: #1B7447;   --ok-bg: #DCEFE3;
  --wait: #7A5200; --wait-bg: #FBEBC6;
  --bad: #A62F1C;  --bad-bg: #F8DCD5;
  --info-bg: #E2EEF0; --info: #1D4F5C;
  --r: 10px;
  --font: "IBM Plex Sans Arabic", Tahoma, "Segoe UI", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 16px/1.7 var(--font); }
img, svg { max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4 { line-height: 1.35; margin: 0; }
p { margin: 0 0 .6em; }
button, input, select, textarea { font: inherit; color: inherit; }
.ltr { direction: ltr; text-align: left; unicode-bidi: plaintext; }
.ltr-ph::placeholder { direction: rtl; }
.muted { color: var(--muted); }
.text-bad { color: var(--bad); font-weight: 600; }
.end { text-align: left; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* الهيكل */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 264px; flex: none; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; padding: 4px 8px 22px; }
.brand img { border-radius: 10px; flex: none; }
.brand strong { display: block; font-size: 17px; line-height: 1.3; }
.brand small { display: block; color: #9DB8AD; font-size: 13px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  text-decoration: none; padding: 11px 14px; border-radius: 8px; font-weight: 500;
  transition: background .18s, color .18s; border-right: 4px solid transparent;
}
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a.on { background: var(--side-2); color: #fff; border-right-color: var(--accent); }
.side-user { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid #25453B; }
.who { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.who strong { display: block; color: #fff; font-size: 15px; line-height: 1.3; }
.who small { color: #9DB8AD; }
.side-actions { display: flex; gap: 14px; font-size: 14px; }
.side-actions a, .side-actions button { background: none; border: 0; padding: 0; color: #B9CFC5; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.side-actions a:hover, .side-actions button:hover { color: #fff; }
.main { flex: 1; min-width: 0; }
.top { display: none; }
.content { max-width: 1120px; margin: 0 auto; padding: 32px 36px 72px; }
.scrim { display: none; }

/* الصورة الشخصية */
.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--soft); }
.avatar-ph { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; }

/* العناوين */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-title { font-size: clamp(26px, 3.4vw, 36px); font-weight: 700; letter-spacing: -.01em; }
.page-head .muted { max-width: 62ch; margin-top: 6px; }
.crumbs { margin-bottom: 8px; font-size: 14px; }
.crumbs a { color: var(--muted); }
.card-title { font-size: 20px; font-weight: 600; margin-bottom: 14px; }
.sub-title { font-size: 16px; font-weight: 600; margin: 18px 0 8px; }

/* البطاقات والشبكات */
.card { background: var(--surface); border-radius: var(--r); padding: 24px; margin-bottom: 22px; }
.card.narrow { max-width: 520px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.card .stack { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 22px; align-items: start; }
.cards-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: stretch; margin-bottom: 22px; }
.cards-2 > .card { margin-bottom: 0; display: flex; flex-direction: column; }
.cards-2 > .card > .form { flex: 1; }
.cards-2 .form > .btn { margin-top: auto; }
.form > .btn { align-self: flex-start; min-width: 170px; }
.figures { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 18px; margin-bottom: 22px; }
.figures-4, .figures-3 { grid-template-columns: repeat(5, 1fr); }
.figures-3 { grid-template-columns: repeat(3, 1fr); }
.fig { background: var(--surface); border-radius: var(--r); padding: 22px; }
.fig-lead { background: var(--side); color: #fff; }
.fig-lead .muted { color: #A9C2B7; }
.fig-lead .bar { background: #28483E; }
.fig h2 { font-size: 15px; font-weight: 500; color: var(--muted); margin-bottom: 10px; }
.fig-lead h2 { color: #A9C2B7; }
.fig-big { font-size: 40px; font-weight: 700; line-height: 1.1; margin-bottom: 10px; letter-spacing: -.02em; }
.fig-big small { font-size: 15px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.fig-lead .fig-big small { color: #A9C2B7; }
.fig-mid { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.fig .btn { margin-top: 12px; }
.link { color: inherit; font-weight: 500; text-underline-offset: 4px; }

/* شريط التقدم */
.bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: 8px 0; min-width: 80px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }

/* الأزرار */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  padding: 10px 20px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; text-decoration: none; line-height: 1.4; min-height: 44px;
  transition: transform .12s, background .18s, border-color .18s;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(.94); border-color: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { filter: brightness(.92); border-color: var(--bad); }
.btn-danger-ghost { color: var(--bad); border-color: transparent; background: transparent; }
.btn-danger-ghost:hover { background: var(--bad-bg); border-color: transparent; }
.btn-small { padding: 4px 14px; min-height: 36px; font-size: 14px; }
.btn-block { width: 100%; }

/* النماذج */
.form { display: flex; flex-direction: column; gap: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field.grow { flex: 1; min-width: 200px; }
.field > span { font-weight: 600; font-size: 15px; }
.input {
  width: 100%; padding: 10px 14px; background: #fff; border: 1px solid #C5CCC2; border-radius: 8px;
  min-height: 46px; transition: border-color .15s, box-shadow .15s;
}
textarea.input { resize: vertical; line-height: 1.7; }
textarea.tall { min-height: 200px; }
.input:focus { border-color: var(--ink); outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; }
.input:disabled { background: var(--soft); color: var(--muted); }
input[type=file].input { padding: 9px 12px; background: var(--ground); }
input[type=color].input { padding: 4px; height: 46px; }
.hint { color: var(--muted); font-size: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 16px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 4px; accent-color: var(--ink); flex: none; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.wc-ok { color: var(--ok); font-weight: 600; }

/* التنبيهات */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: #0F4D2E; }
.flash-err { background: var(--bad-bg); color: #7B2012; }
.flash-warn { background: var(--wait-bg); color: var(--wait); }
.flash-info { background: var(--info-bg); color: var(--info); }
.flash-hide { opacity: 0; max-height: 0; padding: 0 16px; margin: 0; overflow: hidden; transition: all .5s; }
.flash-float { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 20; max-width: 90vw; }

/* الحالات */
.chip { display: inline-block; padding: 2px 12px; border-radius: 99px; font-size: 13.5px; font-weight: 600; line-height: 1.7; white-space: nowrap; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-wait { background: var(--wait-bg); color: var(--wait); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }
.chip-idle { background: var(--soft); color: var(--muted); }

/* الجداول */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: right; font-weight: 600; color: var(--muted); font-size: 14px; padding: 10px 12px; border-bottom: 2px solid var(--soft); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--soft); vertical-align: middle; }
.table tbody tr:hover { background: #F7F8F5; }
.row-off { opacity: .55; }
.cell-bar { min-width: 130px; }
.cell-bar small { color: var(--muted); }
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filters .input { width: auto; flex: 1; min-width: 180px; }
.pager { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.pager a { padding: 4px 12px; border-radius: 6px; text-decoration: none; background: var(--soft); }
.pager a.on { background: var(--ink); color: #fff; }

/* صفوف المهمات والأقسام */
.task-row, .section-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--surface); border-radius: var(--r); padding: 18px 22px; text-decoration: none;
  transition: transform .18s, box-shadow .18s; border-right: 5px solid transparent;
}
.task-row:hover, .section-row:hover { border-right-color: var(--accent); transform: translateX(-3px); }
.task-main, .sec-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 220px; }
.task-main strong, .sec-main strong { font-size: 18px; }
.task-state, .sec-state { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-row { gap: 18px; flex-wrap: nowrap; }
.section-row .sec-main { min-width: 0; }
.sec-no { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 8px; background: var(--soft); border-radius: 8px; font-weight: 700; flex: none; }
.sec-no.big { min-width: 44px; height: 44px; font-size: 22px; background: var(--accent); color: var(--accent-ink); vertical-align: middle; margin-left: 8px; }
.summary { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; align-items: center; }
.summary > div:first-child { flex: 1; min-width: 240px; }
.checks { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.checks .ok { color: var(--ok); font-weight: 600; }

/* ملفات وشواهد */
.files { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.file { display: inline-flex; gap: 12px; align-items: center; padding: 8px 14px; background: var(--ground); border-radius: 8px; text-decoration: none; max-width: 100%; }
.file:hover { background: var(--soft); }
.file-name { font-weight: 500; overflow-wrap: anywhere; }
.file-size { color: var(--muted); font-size: 13px; white-space: nowrap; }
.file-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; margin: 12px 0 20px; }
.shot { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.shot figcaption { font-size: 14px; color: var(--muted); }
.thumb { display: block; background: var(--soft); border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.thumb:hover img { transform: scale(1.04); }
.file-row .thumb { width: 72px; aspect-ratio: 1; flex: none; }
.paper-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 10px 0; }
.paper-gallery figure { margin: 0; break-inside: avoid; }
.paper-gallery img { width: 100%; max-height: 300px; object-fit: contain; background: var(--ground); display: block; }
.paper-gallery figcaption { font-size: 13px; color: var(--muted); }
.item { background: var(--ground); border-radius: var(--r); padding: 16px 18px; }
details.item summary { cursor: pointer; list-style: none; }
details.item summary::-webkit-details-marker { display: none; }
details.item[open] summary { margin-bottom: 10px; }
.item h3 { font-size: 18px; }
.sub-item { background: var(--surface); border-radius: 8px; padding: 12px 14px; margin: 10px 0; }
.sub-item h4 { margin-bottom: 6px; }
.dl { margin: 8px 0; display: grid; gap: 10px; }
.dl dt { color: var(--muted); font-size: 14px; font-weight: 600; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.prose { line-height: 1.9; overflow-wrap: anywhere; }
.comment { background: var(--wait-bg); padding: 10px 14px; border-radius: 8px; margin: 8px 0 0; }
.review-box { border-right: 5px solid var(--line); }
.review-accepted { border-right-color: var(--ok); }
.review-revise { border-right-color: var(--bad); }
.review-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.review-form .field { margin-bottom: 0; }
.review-form .btn { margin-bottom: 0; }
.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.profile-top { display: flex; gap: 22px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.who-big { display: flex; gap: 16px; align-items: center; }
.logo-edit { display: flex; gap: 22px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.logo-edit img { border-radius: 14px; background: var(--soft); object-fit: contain; }
.danger-zone { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--soft); }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form .input { width: 240px; }
.center-card { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }

/* الدخول */
.login { display: flex; min-height: 100vh; }
.login-form { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 24px; background: var(--surface); }
.login-box { width: 100%; max-width: 400px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 36px; }
.login-brand img { border-radius: 14px; }
.login-brand strong { display: block; font-size: 20px; line-height: 1.3; }
.login-brand small { color: var(--muted); }
.login-box h1 { font-size: 34px; margin-bottom: 6px; }
.login-box > .muted { margin-bottom: 24px; }
.login-box .hint { margin-top: 18px; }
.login-art {
  flex: 1.15; background: var(--side); color: #fff; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between; padding: 56px 56px 0;
}
.login-art-text h2 { font-size: clamp(34px, 4.6vw, 62px); line-height: 1.15; font-weight: 700; letter-spacing: -.02em; max-width: 12ch; }
.login-art-text p { color: #B9CFC5; font-size: 18px; max-width: 34ch; margin-top: 18px; }
.stairs { width: 100%; max-height: 52vh; display: block; margin-top: 24px; }
.stairs rect { transform-origin: bottom; animation: rise .9s cubic-bezier(.2, .8, .2, 1) both; }
.stairs rect:nth-child(2) { animation-delay: .08s; } .stairs rect:nth-child(3) { animation-delay: .16s; }
.stairs rect:nth-child(4) { animation-delay: .24s; } .stairs rect:nth-child(5) { animation-delay: .32s; }
@keyframes rise { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }

/* الظهور التدريجي */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* الطباعة وملف الورق */
.print-bar { display: flex; gap: 10px; align-items: center; padding: 14px 20px; background: var(--surface); flex-wrap: wrap; }
.paper { background: #fff; max-width: 820px; margin: 20px auto; padding: 48px 56px; }
.paper-head { display: flex; gap: 14px; align-items: center; padding-bottom: 14px; border-bottom: 3px solid var(--accent); margin-bottom: 28px; }
.paper-head img { border-radius: 10px; }
.paper-cover { display: flex; gap: 24px; align-items: center; margin-bottom: 24px; }
.paper-cover h1 { font-size: 30px; }
.paper-cover h2 { font-size: 22px; font-weight: 600; margin: 4px 0; }
.paper-sec { margin-bottom: 26px; break-inside: avoid-page; }
.paper-sec h3 { font-size: 20px; background: var(--ground); padding: 8px 14px; border-right: 5px solid var(--accent); margin-bottom: 12px; }
.paper-item { margin: 12px 0 12px 0; padding: 0 14px; }
.paper-item h4 { font-size: 17px; }
.paper-img { max-width: 100%; max-height: 360px; display: block; margin: 8px 0; }

/* مشاركة الملف */
.linkbox { display: flex; gap: 10px; flex-wrap: wrap; }
.linkbox .input { flex: 1; min-width: 240px; }
.big-check { padding: 16px; background: var(--ground); border-radius: var(--r); margin-bottom: 22px; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.pick-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--ground); border-radius: 8px; cursor: pointer; }
.pick-row input { width: 20px; height: 20px; margin-top: 5px; accent-color: var(--ink); flex: none; }
.pick-row small { display: block; }
.pick-off { opacity: .55; cursor: not-allowed; }


/* اختيار القالب واللون */
.tpl-grid { margin-bottom: 22px; }
.tpl-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
.tpl { display: flex; flex-direction: column; gap: 4px; padding: 10px; background: var(--ground); border-radius: var(--r); cursor: pointer; border: 2px solid transparent; transition: border-color .15s, transform .15s; }
.tpl:hover { transform: translateY(-2px); }
.tpl:has(input:checked) { border-color: var(--ink); background: var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.tpl input { position: absolute; opacity: 0; pointer-events: none; }
.tpl svg { width: 100%; height: auto; border-radius: 6px; display: block; margin-bottom: 4px; }
.tpl svg .d { fill: var(--pd); } .tpl svg .a { fill: var(--pa); } .tpl svg .l { fill: #D8DDD5; } .tpl svg .w { fill: #fff; }
.tpl small { font-size: 13px; line-height: 1.5; }
.tpl:has(input:focus-visible), .swatch:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
/* وسائط وروابط مضمَّنة */
.media-list { display: flex; flex-direction: column; gap: 14px; margin: 12px 0; }
.media-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.player { display: block; width: 100%; max-width: 640px; max-height: 420px; background: #0B1411; border-radius: 6px; }
.audio { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 560px; }
.audio audio { width: 100%; }
.embed { position: relative; width: 100%; max-width: 720px; aspect-ratio: 16 / 9; margin: 10px 0; background: #0B1411; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.sec-plus { background: var(--accent); color: var(--accent-ink); }

.cover-preview { aspect-ratio: 3 / 1; max-width: 720px; overflow: hidden; background: var(--soft); border-radius: 6px; margin-bottom: 14px; }
.cover-preview img, .cover-preview svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.paper-banner { height: 160px; overflow: hidden; margin: 0 0 24px; background: var(--ground); }
.paper-banner img, .paper-banner svg { width: 100%; height: 100%; object-fit: cover; display: block; }

/* الترتيب بالسحب والإفلات */
.sort-tools { display: inline-flex; gap: 4px; align-items: center; }
.sort-tools.inline { margin-inline-end: 10px; vertical-align: middle; }
.sort-tools button { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; color: var(--ink); transition: background .15s; }
.sort-tools button:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.sort-tools .drag-handle { cursor: grab; font-size: 18px; }
[draggable="true"] .drag-handle { cursor: grabbing; }
.dragging { opacity: .45; }
.sort-status { margin: 8px 0 0; font-size: 14px; font-weight: 600; color: var(--ok); }
.sort-status.bad { color: var(--bad); }
.pick-sortable { grid-template-columns: 1fr; }
.pick-item { display: flex; gap: 10px; align-items: center; }
.pick-item .pick-row { flex: 1; min-width: 0; }
.gallery-edit .shot { position: relative; }
.gallery-edit .shot .sort-tools { margin-bottom: 6px; }

/* ضبط موضع الصورة */
.focus { margin: 6px 0; }
.focus > summary { list-style: none; cursor: pointer; display: inline-flex; }
.focus > summary::-webkit-details-marker { display: none; }
.focus-form { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.focus-frame { position: relative; width: 100%; overflow: hidden; background: var(--soft); cursor: grab; touch-action: none; border-radius: 6px; user-select: none; }
.focus-frame.drag { cursor: grabbing; }
.focus-frame img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.focus-frame:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.gallery-edit { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); align-items: start; }

.fontpick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.fontopt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 10px; background: var(--ground); border-radius: var(--r); cursor: pointer; border: 2px solid transparent; transition: border-color .15s; }
.fontopt:has(input:checked) { border-color: var(--ink); background: var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.fontopt:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.fontopt input { position: absolute; opacity: 0; pointer-events: none; }
.fontopt .fs { font-size: 26px; font-weight: 700; line-height: 1.5; }
@media (max-width: 860px) { .fontpick { grid-template-columns: 1fr 1fr; } }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch .dot { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); transition: box-shadow .15s, transform .15s; }
.swatch:hover .dot { transform: scale(1.06); }
.swatch:has(input:checked) .dot { box-shadow: 0 0 0 3px var(--ink); }
.swatch small { font-size: 13px; color: var(--muted); }
@media (max-width: 860px) { .tpl-list { grid-template-columns: 1fr 1fr; } }

.lb { position: fixed; inset: 0; z-index: 50; background: rgba(8, 18, 14, .92); display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; animation: lbin .2s ease; }
.lb img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
@keyframes lbin { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 1100px) {
  .figures, .figures-4 { grid-template-columns: 1fr 1fr; }
  .figures-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .side { position: fixed; inset: 0 0 0 auto; right: 0; z-index: 30; transform: translateX(100%); transition: transform .25s; width: 280px; }
  .nav-open .side { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 20, 16, .5); z-index: 25; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .nav-open .scrim { opacity: 1; pointer-events: auto; }
  .top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 10; }
  .top-title { font-weight: 600; }
  .menu-btn { width: 44px; height: 44px; background: none; border: 0; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 10px; cursor: pointer; }
  .menu-btn span { height: 2.5px; background: #fff; border-radius: 2px; display: block; }
  .content { padding: 22px 16px 60px; }
  .grid-2, .grid-3, .cards-2 { grid-template-columns: 1fr; }
  .figures, .figures-4, .figures-3 { grid-template-columns: 1fr; }
  .login { flex-direction: column-reverse; }
  .login-art { padding: 28px 24px 0; min-height: 260px; }
  .login-art-text p { font-size: 16px; }
  .stairs { max-height: 150px; }
  .section-row { flex-wrap: wrap; }
  .pick { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .paper { padding: 24px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
@media print {
  body { background: #fff; font-size: 12pt; }
  .side, .top, .scrim, .no-print, .print-bar, .btn, form { display: none !important; }
  .content, .main { padding: 0; max-width: none; }
  .card { break-inside: avoid; }
  .paper { margin: 0; padding: 0; max-width: none; }
  .table { font-size: 11pt; }
}
