@font-face { font-family: "Archivo"; src: url("../fonts/Archivo-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("../fonts/Archivo-SemiBold.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
/* زميل — نظام الهوية: أخضر عميق، عاجي، وذهبي للتفاصيل.
   IBM Plex Sans Arabic هو الخط الرئيسي، وArchivo للأرقام واللاتيني.
   تبقى أسماء متغيرات --blue للتوافق مع المكونات، وقيمها من أخضر زميل. */

@font-face { font-family: "Plex Arabic"; src: url("../fonts/Plex-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/Plex-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/Plex-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url("../fonts/Plex-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --font: "Plex Arabic", "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
  --font-num: "Archivo", "Plex Arabic", sans-serif;

  /* الحبر */
  --ink: #142C25;
  --ink-2: #394F45;
  --ink-3: #52655C;      /* ≥ 4.5:1 على الأرضية */
  --ink-4: #A3B1A7;      /* زخرفة فقط */
  --line: rgba(23, 63, 53, 0.12);
  --line-2: rgba(23, 63, 53, 0.22);
  --fill: rgba(78, 106, 87, 0.12);
  --fill-2: rgba(78, 106, 87, 0.2);

  /* الأسطح */
  --canvas: #F3F1E9;
  --canvas-2: #F7F4ED;
  --brand-pine: #173F35; --brand-forest: #102D26; --brand-ivory: #F7F4ED;
  --brand-gold: #B6A37B; --brand-sage: #DCE6DE; --brand-surface: #FFFDF8;
  --card: #FFFDF8;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-line: rgba(255, 255, 255, 0.7);

  /* الفعل والحالات */
  --blue: #173F35;
  --blue-h: #102D26;
  --blue-soft: #E3EBE3;
  --blue-t: #102D26;    /* نص أخضر داكن على الغسلة الفاتحة */
  --link: #173F35;
  --link-d: #B6A37B;
  --green: #286343;
  --green-t: #245A3D;   /* نص أخضر صغير على غسلة: ≥ 4.5:1 */
  --green-soft: #EAF1E8;
  --orange: #75551F;
  --orange-soft: #F2EAD9;
  --red: #AD3F35;
  --red-soft: #FBEAE5;
  --purple: #536F62;
  --grad: linear-gradient(90deg, #B6A37B 0%, #476E5D 55%, #B6A37B 100%);
  --grad-icon: #173F35;

  /* الشكل */
  --r-xs: 8px; --r-sm: 10px; --r-md: 14px; --r-lg: 18px; --r-xl: 22px; --r-2xl: 28px; --r-pill: 999px;
  --sh-1: 0 1px 1px rgba(0, 0, 0, 0.03), 0 2px 8px rgba(0, 0, 0, 0.04);
  --sh-2: 0 2px 4px rgba(0, 0, 0, 0.04), 0 10px 30px rgba(0, 0, 0, 0.07);
  --sh-3: 0 24px 60px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.06);
  --sh-glass: 0 8px 32px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.65);

  /* الحركة */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --t-fast: 160ms; --t: 280ms; --t-slow: 360ms;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* لا تباعد حروف ولا تحويل حالة على العربي */
[lang="ar"], [lang="ar"] * { letter-spacing: normal; text-transform: none; }
[hidden] { display: none !important; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration: none; }
@media (hover: hover) and (pointer: fine) { a:hover { text-decoration: underline; text-underline-offset: 0.2em; } }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; inset-inline-start: 16px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: var(--r-pill); background: var(--ink); color: #fff; }
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid rgba(23, 63, 53, 0.45); outline-offset: 2px; border-radius: 8px; }
::selection { background: rgba(23, 63, 53, 0.2); }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ── أيقونة التطبيق والاسم ── */
.appicon {
  display: inline-grid; place-items: center; flex: none;
  inline-size: 32px; block-size: 32px; border-radius: 9px;
  background: var(--grad-icon); color: #fff;
  font: 700 18px/1 var(--font); padding-block-end: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 2px rgba(0, 0, 0, 0.12);
}
.appicon.lg { inline-size: 64px; block-size: 64px; border-radius: 16px; font-size: 36px; }

/* ── الأزرار: كبسولة، تضغط فتنكمش ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-block-size: 44px; padding: 0 22px; border: 0; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 600; line-height: 1; white-space: nowrap; text-decoration: none;
  background: var(--fill); color: var(--ink);
  transition: background var(--t-fast) ease, color var(--t-fast) ease, transform 100ms ease-out, box-shadow var(--t-fast) ease;
}
@media (hover: hover) and (pointer: fine) { .btn:hover { text-decoration: none; background: var(--fill-2); } }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
@media (hover: hover) and (pointer: fine) { .btn-primary:hover { background: var(--blue-h); } }
.btn-tinted { background: var(--blue-soft); color: var(--blue-t); }
@media (hover: hover) and (pointer: fine) { .btn-tinted:hover { background: #D5E2D5; } }
.btn-dark { background: var(--ink); color: #fff; }
@media (hover: hover) and (pointer: fine) { .btn-dark:hover { background: #000; } }
.btn-plain { background: transparent; color: var(--link); padding-inline: 10px; }
@media (hover: hover) and (pointer: fine) { .btn-plain:hover { background: transparent; text-decoration: underline; } }
.btn-danger { background: var(--red-soft); color: var(--red); }
@media (hover: hover) and (pointer: fine) { .btn-danger:hover { background: #F4D7CF; color: #8E2D25; } }
.btn-sm { min-block-size: 34px; padding: 0 15px; font-size: 14px; }
.btn-lg { min-block-size: 52px; padding: 0 28px; font-size: 17px; }
.btn-icon { inline-size: 38px; min-block-size: 38px; padding: 0; border-radius: 50%; }
.chev::after { content: "‹"; font-size: 1.25em; line-height: 0.6; margin-inline-start: 2px; font-weight: 500; }

/* ── الحقول ── */
.input, .select, .textarea {
  inline-size: 100%; min-block-size: 46px; padding: 10px 14px;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--fill); color: var(--ink); font-size: 16px;
  transition: background var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.textarea { resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { outline: none; background: #fff; box-shadow: 0 0 0 4px rgba(23, 63, 53, 0.22), 0 0 0 1px var(--blue) inset; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .flabel { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field small, .flabel small { font-weight: 400; color: var(--ink-3); }
.hint { font-size: 13.5px; color: var(--ink-3); line-height: 1.55; }

/* ── التحكم المجزّأ (Segmented control) ── */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--fill); max-inline-size: 100%; }
.seg button {
  min-block-size: 34px; padding: 0 16px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background var(--t-fast) ease, box-shadow var(--t-fast) ease, color var(--t-fast) ease;
}
@media (hover: hover) and (pointer: fine) { .seg button:hover:not(:disabled) { color: var(--ink); } }
.seg button[aria-checked="true"], .seg button[aria-selected="true"], .seg button[aria-pressed="true"] {
  background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(0, 0, 0, 0.04);
}
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── الشارات ── */
.tag { display: inline-flex; align-items: center; gap: 5px; block-size: 24px; padding: 0 9px; border-radius: 7px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--fill); color: var(--ink-2); }
.tag-blue { background: var(--blue-soft); color: var(--blue-t); }
.tag-green { background: var(--green-soft); color: var(--green-t); }
.tag-orange { background: var(--orange-soft); color: var(--orange); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-dot::before { content: ""; inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; }
.badge { display: inline-grid; place-items: center; min-inline-size: 18px; block-size: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: rgba(255, 255, 255, 0.97); --glass-strong: #fff; }
}
@media (prefers-contrast: more) {
  :root { --ink-3: #394F45; --line: rgba(23, 63, 53, 0.3); }
}
