/* هوية المسابقة: أخضر داكن وذهبي، مأخوذة من مقطع الجمعية وشعار المسابقة. */
:root {
  --green-950: #0a2a1f;
  --green-900: #0f3a2b;
  --green-800: #154a37;
  --green-700: #1c5c45;
  --green-100: #e6efe9;
  --gold: #c9a24a;
  --gold-soft: #e3c983;
  --gold-deep: #9c7a2c;
  --paper: #fbf8f1;
  --card: #ffffff;
  --ink: #17251f;
  --ink-2: #4a5a52;
  --line: #e4ddcc;
  --danger: #b3261e;
  --ok: #1d7a4a;
  --warn: #a86a00;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(10, 42, 31, .06), 0 8px 24px rgba(10, 42, 31, .07);
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --font-display: 'Amiri', 'IBM Plex Sans Arabic', serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--paper); color: var(--ink); line-height: 1.75; font-size: 16px; }
img { max-width: 100%; display: block; }
a { color: var(--green-700); }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* أزرار */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 44px; padding: .55em 1.2em; border-radius: 999px; border: 1.5px solid transparent; background: var(--green-800); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; transition: transform .12s, background .15s, box-shadow .15s; line-height: 1.3; }
.btn:hover { background: var(--green-700); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.gold { background: var(--gold); color: var(--green-950); }
.btn.gold:hover { background: var(--gold-soft); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--green-100); }
.btn.danger { background: transparent; color: var(--danger); border-color: #ecc9c6; }
.btn.danger:hover { background: #fbeceb; }
.btn.sm { min-height: 36px; padding: .3em .9em; font-size: .9rem; }
.btn.block { width: 100%; }

/* بطاقات */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .grid.c2 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: repeat(3, 1fr); } .grid.c4 { grid-template-columns: repeat(4, 1fr); } }
.chip { display: inline-flex; align-items: center; gap: .35em; padding: .15em .7em; border-radius: 999px; background: var(--green-100); color: var(--green-800); font-size: .85rem; font-weight: 600; line-height: 1.6; }
.chip.gold { background: #f6ecd2; color: var(--gold-deep); }
.chip.red { background: #fbeceb; color: var(--danger); }
.chip.gray { background: #eeeeea; color: #555; }

/* نماذج */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span { font-weight: 600; font-size: .95rem; }
.field small { color: var(--ink-2); line-height: 1.6; }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: .55em .85em; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
textarea.input { min-height: 100px; resize: vertical; line-height: 1.7; }
.input:focus { border-color: var(--green-700); outline: none; box-shadow: 0 0 0 3px rgba(28, 92, 69, .15); }
.field.err .input { border-color: var(--danger); background: #fffafa; }
.field .err-msg { color: var(--danger); font-size: .88rem; font-weight: 600; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg label { flex: 1 1 120px; display: flex; align-items: center; justify-content: center; gap: .4em; min-height: 46px; padding: .4em .8em; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer; font-weight: 600; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { border-color: var(--green-700); background: var(--green-100); color: var(--green-900); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--gold); }
.check { display: flex; gap: .6em; align-items: flex-start; line-height: 1.7; }
.check input { width: 20px; height: 20px; margin-top: .25em; accent-color: var(--green-700); flex: none; }

/* جداول */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th, table.t td { padding: .6em .75em; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
table.t th { background: #f6f2e7; font-weight: 700; position: sticky; top: 0; z-index: 1; }
table.t tr:hover td { background: #fbf9f3; }

/* رسالة سريعة */
#toast { position: fixed; inset-inline: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 100; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { background: var(--green-950); color: #fff; padding: .7em 1.2em; border-radius: 12px; box-shadow: var(--shadow); max-width: 520px; pointer-events: auto; line-height: 1.6; }
.toast.err { background: var(--danger); }

/* نافذة */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 30, 22, .45); z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--paper); width: 100%; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); }
@media (min-width: 720px) { .modal-bg { align-items: center; } .modal { width: min(680px, 100% - 32px); border-radius: 20px; } }
.modal h3 { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }

/* زخرفة */
.ornament { position: absolute; pointer-events: none; opacity: .9; }
.demo-bar { background: #fff3d6; color: #6b4b00; text-align: center; font-size: .88rem; padding: .45em 1em; line-height: 1.6; }
