:root {
  --primary: #2563EB; --primary-dark: #1D4ED8; --navy: #1E3A8A; --gold: #B8860B;
  --ink: #0F172A; --text: #1E293B; --muted: #64748B; --line: #E2E8F0; --soft: #F1F5F9;
  --bg: #F1F5F9; --card: #FFFFFF; --ok: #15803D; --bad: #B91C1C; --warn: #C2410C;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: hidden; }
body { font-family: "Cairo", "Segoe UI", Tahoma, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }
a { color: var(--primary); }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.req { color: var(--bad); font-weight: 700; }
.gold { color: var(--gold); font-weight: 700; }

/* ---------- public header ---------- */
.hero { display: flex; align-items: center; gap: 14px; justify-content: center; padding: 22px 16px 18px;
        background: linear-gradient(180deg, #0F172A, #1E293B); color: #fff; text-align: right; }
.hero .logo { width: 78px; height: 78px; object-fit: contain; }
.hero h1 { margin: 0; font-size: 22px; font-weight: 800; }
.hero .gold { color: #E8C27A; }
.hero .muted { color: #94A3B8; }

.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
        margin-bottom: 14px; box-shadow: 0 2px 10px rgba(15,23,42,.04); }
.card h2 { margin: 0 0 6px; font-size: 20px; color: var(--ink); }
.card h3 { margin: 0 0 14px; font-size: 17px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary);
       color: #fff; font-size: 13px; }
.intro p { margin: 4px 0; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid .full { grid-column: 1 / -1; }
label { display: block; font-weight: 600; color: #334155; font-size: 14px; }
label > input, label > select, label > textarea { display: block; margin-top: 5px; }
label > .hint { display: block; margin-top: 3px; font-size: 12px; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--text); width: 100%; padding: 10px 12px;
        border: 1px solid #CBD5E1; border-radius: 9px; background: #fff; min-height: 44px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
input[dir=ltr] { text-align: right; }
textarea { resize: vertical; }
label.check { display: flex; flex-direction: row; align-items: center; gap: 10px; font-weight: 600; }
label.check > input { margin-top: 0; }
label.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); }
.consent { margin-top: 12px; font-weight: 400 !important; }
.hint { font-weight: 400; min-height: 1em; }
.hint.ok { color: var(--ok); } .hint.bad { color: var(--bad); }
.kids { display: contents; }
.kids.hidden label { display: none; }

.row-item { display: grid; grid-template-columns: repeat(4, 1fr) 38px; gap: 8px; margin-bottom: 8px; }
.row-item .x { border: 1px solid #FECACA; background: #FEF2F2; color: var(--bad); border-radius: 8px; cursor: pointer; font-size: 15px; }

.photo-box { display: flex; justify-content: center; }
.photo-drop { width: 170px; height: 200px; border: 2px dashed #93C5FD; border-radius: 16px; background: #EFF6FF;
              display: grid; place-items: center; text-align: center; cursor: pointer; overflow: hidden; position: relative;
              color: var(--navy); font-size: 14px; }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; }
.photo-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-drop span { font-size: 15px; line-height: 1.8; }

.btn { font: inherit; font-weight: 700; border: none; border-radius: 9px; padding: 10px 18px; cursor: pointer;
       background: var(--primary); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: #EFF6FF; color: var(--primary-dark); border: 1px solid #BFDBFE; }
.btn.ghost:hover { background: #DBEAFE; }
.btn.light { background: #fff; color: #334155; border: 1px solid #CBD5E1; }
.btn.light:hover { background: var(--soft); }
.btn.danger { background: #DC2626; } .btn.danger:hover { background: var(--bad); }
.btn.ok { background: #16A34A; } .btn.ok:hover { background: var(--ok); }
.btn.big { width: 100%; justify-content: center; font-size: 18px; padding: 14px; margin: 4px 0 26px; }
.btn[disabled] { opacity: .6; cursor: wait; }

.alert { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; }
.alert ul { margin: 6px 0 0; padding-inline-start: 20px; }
.notice { background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; border-radius: 12px; padding: 10px 16px; margin-bottom: 14px; }
.thanks .big-check { width: 72px; height: 72px; border-radius: 50%; background: #DCFCE7; color: var(--ok); font-size: 40px;
                     display: grid; place-items: center; margin: 6px auto 8px; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.foot { text-align: center; padding: 10px 0 28px; }

@media (max-width: 620px) {
  .grid { grid-template-columns: 1fr; }
  .row-item { grid-template-columns: 1fr 1fr; }
  .row-item .x { grid-column: 1 / -1; height: 34px; }
  .hero { flex-direction: column; text-align: center; }
}

/* ---------- admin ---------- */
body.admin { background: var(--bg); }
.topbar { background: #0F172A; color: #fff; padding: 10px 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar img { width: 42px; height: 42px; object-fit: contain; }
.topbar .title { font-weight: 800; font-size: 17px; }
.topbar .title small { display: block; color: #E8C27A; font-weight: 600; font-size: 12px; }
.topbar nav { margin-inline-start: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.topbar nav a { color: #CBD5E1; text-decoration: none; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; }
.topbar nav a:hover, .topbar nav a.on { background: #1E293B; color: #38BDF8; }
.admin-wrap { max-width: 1280px; margin: 0 auto; padding: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; border-right: 4px solid var(--primary); }
.stat b { display: block; font-size: 26px; color: var(--ink); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { background: var(--soft); text-align: right; padding: 10px; color: #334155; white-space: nowrap; border-bottom: 2px solid var(--line); }
table.list td { padding: 8px 10px; border-bottom: 1px solid var(--soft); vertical-align: middle; }
table.list tr:hover td { background: #F8FAFC; }
.thumb { width: 40px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--soft); display: block; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.b-new { background: #DBEAFE; color: #1D4ED8; } .b-reviewed { background: #DCFCE7; color: #15803D; }
.b-exported { background: #E2E8F0; color: #475569; } .b-dup { background: #FEE2E2; color: #B91C1C; }
.pager { display: flex; gap: 6px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.pager a, .pager span { padding: 6px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); text-decoration: none; }
.pager span { background: var(--primary); color: #fff; border-color: var(--primary); }
.detail { display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
.detail .bigphoto { width: 100%; border-radius: 12px; border: 1px solid var(--line); }
dl.kv { display: grid; grid-template-columns: 170px 1fr; margin: 0; }
dl.kv dt { background: var(--soft); padding: 8px 10px; font-weight: 700; color: #334155; border-bottom: 1px solid #fff; }
dl.kv dd { margin: 0; padding: 8px 10px; border-bottom: 1px solid var(--soft); }
.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.export-grid .card { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.export-grid .card p { margin: 0; flex: 1; }
.linkbox { display: flex; gap: 8px; } .linkbox input { direction: ltr; text-align: left; }
.login { max-width: 380px; margin: 60px auto; }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; } dl.kv { grid-template-columns: 120px 1fr; } }

[hidden] { display: none !important; }
