/* Shared components — depends on tokens.css */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font-ar); font-size: var(--fs-md); line-height: 1.6;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; }
p { margin: 0; }
a { color: var(--gold-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.ltr { direction: ltr; unicode-bidi: isolate; font-family: var(--font-en); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* ---- Brand wordmark (temporary — official logo file not supplied) ---- */
.wordmark { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; font-family: var(--font-en); user-select: none; }
.wordmark .wm-top { font-weight: 800; font-size: 22px; letter-spacing: .5px; color: var(--brand-black); }
.wordmark .wm-sub { margin-top: 6px; font-size: 10.5px; font-weight: 500; letter-spacing: 6.5px; color: var(--brand-gold); padding-inline-start: 6px; }
.wordmark.on-dark .wm-top { color: var(--white); }
.wordmark.lg .wm-top { font-size: 28px; }
.wordmark.lg .wm-sub { font-size: 12px; letter-spacing: 8.5px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--white); color: var(--text);
  font-weight: 600; font-size: var(--fs-md); cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-gold); color: var(--brand-black); }
.btn-primary:hover:not(:disabled) { background: #B88D5B; }
.btn-dark { background: var(--brand-black); color: var(--white); }
.btn-dark:hover:not(:disabled) { background: #1d1f1f; }
.btn-outline { border-color: var(--border); background: var(--white); }
.btn-outline:hover:not(:disabled) { border-color: var(--gold-line); background: var(--gold-tint); }
.btn-ghost { background: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--gold-tint); }
.btn-approve { background: var(--approved); color: var(--white); }
.btn-approve:hover:not(:disabled) { background: #11692F; }
.btn-reject { background: var(--white); color: var(--disapproved); border-color: #EBC6C6; }
.btn-reject:hover:not(:disabled) { background: var(--disapproved-tint); }
.btn-danger { background: var(--disapproved); color: var(--white); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: var(--fs-sm); border-radius: 7px; gap: 5px; }
.btn-lg { min-height: 50px; padding: 12px 22px; font-size: var(--fs-lg); border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { min-height: 32px; width: 32px; padding: 0; }
.spinner { width: 18px; height: 18px; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: var(--fs-sm); color: var(--text); }
.req { color: var(--disapproved); margin-inline-start: 2px; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 15.5px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 90px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-gold); box-shadow: var(--focus); }
.input[readonly] { background: var(--bg); color: var(--text-2); }
.input.ltr { text-align: left; }
.input::placeholder, .textarea::placeholder { color: #A3A3A3; }
.field.has-error .input, .field.has-error .textarea { border-color: var(--disapproved); }
.field-error { color: var(--disapproved); font-size: var(--fs-sm); display: none; }
.field.has-error .field-error { display: block; }
.hint { color: var(--text-2); font-size: var(--fs-xs); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: var(--fs-md); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand-black); flex: none; }
.input-wrap { position: relative; }
.input-wrap .input { padding-inline-end: 46px; }
.input-wrap .addon { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge-pending { color: var(--pending); background: var(--pending-tint); border-color: #F0E2BF; }
.badge-approved { color: var(--approved); background: var(--approved-tint); border-color: #CFE9D7; }
.badge-disapproved { color: var(--disapproved); background: var(--disapproved-tint); border-color: #F0D0D0; }
.badge-neutral { color: var(--text-2); background: #F3F3F1; border-color: var(--border); }
.badge-gold { color: var(--gold-ink); background: var(--gold-tint); border-color: var(--gold-line); }

/* ---- Cards ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

/* ---- Alerts ---- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: var(--fs-sm); border: 1px solid; }
.alert-error { background: var(--disapproved-tint); border-color: #F0D0D0; color: #7F1D1D; }
.alert-warn { background: var(--pending-tint); border-color: #F0E2BF; color: #6B4A08; }
.alert-info { background: var(--gold-tint); border-color: var(--gold-line); color: #4A3820; }
.alert-ok { background: var(--approved-tint); border-color: #CFE9D7; color: #14532D; }

/* ---- Modal ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(3, 4, 4, .5); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 100; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: var(--fs-lg); }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-start; padding: 16px 22px; border-top: 1px solid var(--border); background: #FCFCFB; border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }

/* ---- Toasts ---- */
.toasts { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--brand-black); color: var(--white); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: var(--fs-sm); border-inline-start: 4px solid var(--brand-gold); }
.toast.error { border-inline-start-color: #EF4444; }
.toast.ok { border-inline-start-color: #22C55E; }
