/* =============================================================
   SMART PHARMACY · الصيدلية الذكية — نظام الألوان والخطوط
   حبر: #0F3B45  | ورق: #F6F8F8 | نص: #1B2528 | خط فاصل: #D8E0E0
   الحالة: أحمر/برتقالي/أزرق/أخضر/أخضر عريض/رمادي
   ============================================================= */
:root {
  --ink: #0F3B45;
  --ink-2: #1D5563;
  --paper: #F6F8F8;
  --card: #FFFFFF;
  --text: #1B2528;
  --muted: #5D6B6E;
  --line: #D8E0E0;
  --focus: #F2B705;

  --red: #C62828;     --red-bg: #FDECEC;
  --orange: #D97200;  --orange-bg: #FFF3E3;
  --blue: #1E66C9;    --blue-bg: #E9F1FC;
  --green: #2E8B57;   --green-bg: #E8F5EE;
  --surplus: #146B38; --surplus-bg: #D5F0DF;
  --unknown: #98A4A6; --unknown-bg: #EFF2F2;

  --r-sm: 4px;
  --r-md: 8px;
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.boot { padding: 48px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* ---------- Auth screens ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}
.auth-side {
  background: var(--ink);
  color: #fff;
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-side h1 { font-size: 34px; line-height: 1.25; margin: 0 0 12px; font-weight: 700; }
.auth-brand { font-family: 'Amiri', serif; display: flex; flex-direction: column; gap: 2px; }
.auth-brand .bn-en { font-size: 52px; letter-spacing: 2px; line-height: 1.1; direction: ltr; text-align: right; }
.auth-brand .bn-ar { font-size: 34px; font-weight: 400; color: #9FD8B8; }
.auth-brand .ver { align-self: flex-start; margin: 10px 0 0; font-family: 'IBM Plex Sans Arabic', sans-serif; }
.auth-side p { margin: 0; color: #BFD3D6; max-width: 34ch; }
.legend-strip { display: flex; gap: 6px; margin-top: 28px; }
.legend-strip span { height: 10px; flex: 1; border-radius: 2px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 22px; margin: 0 0 4px; }
.auth-card .sub { margin: 0 0 24px; color: var(--muted); }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 500; margin-bottom: 6px; }
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
}
.input:focus { border-color: var(--ink-2); outline: none; box-shadow: 0 0 0 3px rgba(29,85,99,.18); }
.user-input { display: flex; direction: ltr; }
.user-input .input { border-radius: var(--r-md) 0 0 var(--r-md); text-align: left; }
.user-input .suffix {
  padding: 10px 12px; background: var(--unknown-bg); border: 1px solid var(--line); border-left: 0;
  border-radius: 0 var(--r-md) var(--r-md) 0; color: var(--muted); white-space: nowrap;
}
.form-error { background: var(--red-bg); color: var(--red); padding: 10px 12px; border-radius: var(--r-md); margin-bottom: 16px; }
.form-ok { background: var(--green-bg); color: var(--surplus); padding: 10px 12px; border-radius: var(--r-md); margin-bottom: 16px; }
.switch-link { margin-top: 18px; color: var(--muted); }
.switch-link a { color: var(--ink-2); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 500;
}
.btn:hover { border-color: var(--ink-2); }
a.btn { text-decoration: none; color: inherit; }
a.btn-primary { color: #fff; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); }
.btn-save { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { color: var(--red); }
.btn-block { width: 100%; justify-content: center; padding: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 13px; }

/* ---------- App shell ---------- */
.topbar {
  background: var(--ink); color: #fff;
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px; height: 56px; position: sticky; top: 0; z-index: 20;
}
/* خط الهوية: Amiri */
@font-face { font-family: 'Amiri'; font-weight: 700; src: url(../fonts/amiri-arabic-700.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Amiri'; font-weight: 700; src: url(../fonts/amiri-latin-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Amiri'; font-weight: 400; src: url(../fonts/amiri-arabic-400.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Amiri'; font-weight: 400; src: url(../fonts/amiri-latin-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122; }
.brand { display: flex; align-items: center; gap: 4px; white-space: nowrap; font-family: 'Amiri', serif; }
.bn { display: flex; flex-direction: column; line-height: 1; }
.bn-en { font-size: 19px; font-weight: 700; letter-spacing: 1.2px; direction: ltr; }
.bn-ar { font-size: 14px; font-weight: 400; color: #9FD8B8; margin-top: 2px; }
.ver { display: inline-block; font-size: 11px; font-weight: 600; color: #0F3B45; background: #7FD1A5; border-radius: 10px; padding: 1px 8px; vertical-align: middle; margin-inline-start: 6px; }
.auth-side h1 .ver { font-size: 13px; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a {
  color: #BFD3D6; text-decoration: none; padding: 16px 9px; white-space: nowrap; font-size: 14px;
  border-bottom: 3px solid transparent;
}
.nav a:hover { color: #fff; }
.nav a.active { color: #fff; border-bottom-color: var(--focus); }
.userbox { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.userbox .who { text-align: left; line-height: 1.2; }
.userbox .who small { display: block; color: #BFD3D6; font-size: 11px; }
.icon-btn {
  position: relative; background: transparent; border: 0; color: #fff; cursor: pointer;
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
}
.icon-btn:hover { background: rgba(255,255,255,.1); }
.badge {
  position: absolute; top: 3px; left: 3px; background: var(--red); color: #fff;
  font-size: 10px; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px;
}
.menu {
  position: absolute; top: 52px; left: 16px; width: min(380px, calc(100vw - 32px));
  background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(15,59,69,.18); z-index: 30; max-height: 70vh; overflow: auto;
}
.menu header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.notif { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.notif.unread { background: var(--blue-bg); }
.notif b { display: block; font-size: 14px; }
.notif p { margin: 2px 0; font-size: 13px; color: var(--muted); direction: rtl; }
.menu .menu-item { display: block; width: 100%; text-align: right; padding: 10px 14px; background: none; border: 0; cursor: pointer; }
.menu .menu-item:hover { background: var(--paper); }

main { padding: 24px; max-width: 1400px; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
