/* ==========================================================
   نظام المخازن والمشتريات - سلسبيل
   هوية بصرية: مياه الينابيع الصافية (حبر أزرق-مخضر عميق)
   على أرضية حجر كلسي باردة، مع الكهرماني للوقود.
   ========================================================== */

/* الخط مستضاف محلياً ليعمل النظام حتى بدون اتصال بالإنترنت (رخصة OFL) */
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/plex-arabic-400.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/plex-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/plex-arabic-500.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/plex-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/plex-arabic-600.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/plex-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/plex-arabic-700.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/plex-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* هوية سلسبيل: أزرق القطرة، سماوي الماء، أخضر الطبيعة */
  --ink: #0b4a96;          /* أزرق سلسبيل العميق */
  --ink-2: #1060b0;
  --ink-deep: #083877;
  --spring: #1478bf;       /* لون الروابط والتفاعل */
  --sky: #2ba6d9;          /* سماوي القطرة */
  --spring-soft: #e2f1fb;
  --leaf: #6cb33f;         /* أخضر الشعار */
  --leaf-deep: #2e8b3e;
  --paper: #eef4f9;
  --surface: #ffffff;
  --line: #d2deea;
  --line-soft: #e4edf5;
  --text: #14233a;
  --muted: #56677b;
  --fuel: #c27c1e;         /* كهرماني الديزل */
  --fuel-deep: #8f5a12;
  --fuel-soft: #f7ead6;
  --oil: #6b4f2a;
  --ok: #2e8b3e;
  --ok-soft: #e2f3dc;
  --warn: #a96a00;
  --warn-soft: #fbefd4;
  --bad: #b3261e;
  --bad-soft: #f9e0de;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(11, 74, 150, .06), 0 4px 14px rgba(11, 74, 150, .06);
  --font: "IBM Plex Sans Arabic", Tahoma, "Segoe UI", sans-serif;
  --nav-h: 64px;
  --nav-text: #dce9f7;
  --nav-muted: #9dbbe0;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.6;
  font-feature-settings: "tnum" 1;
}
a { color: var(--spring); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--ink); line-height: 1.3; margin: 0; }
h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.08rem; font-weight: 600; }
h3 { font-size: .98rem; font-weight: 600; }
:focus-visible { outline: 3px solid var(--spring); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
:not(td):not(th).num { direction: ltr; display: inline-block; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- الهيكل العام ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); }
.app > div { min-width: 0; }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--ink); color: #fff; border-bottom: 3px solid var(--leaf);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
}
.topbar .brand { color: #fff; font-weight: 700; font-size: 1rem; flex: 1; }
.topbar .brand small { display: block; font-weight: 400; color: var(--nav-muted); font-size: .75rem; }
.topbar .icon-btn { color: #fff; }
.main { padding: 16px 16px calc(var(--nav-h) + 28px); max-width: 1200px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin: 4px 0 18px; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* شريط التنقل السفلي على الهاتف */
.bottomnav {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 40; height: var(--nav-h);
  background: var(--surface); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a, .bottomnav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font: inherit; font-size: .72rem; background: none; border: 0; text-decoration: none;
}
.bottomnav a.is-active { color: var(--ink); font-weight: 600; }
.bottomnav svg { width: 22px; height: 22px; }
.bottomnav .fab span.circle {
  width: 46px; height: 46px; border-radius: 50%; background: var(--spring); color: #fff;
  display: grid; place-items: center; margin-top: -18px; box-shadow: 0 4px 12px rgba(31, 138, 153, .4);
}
.bottomnav .fab svg { width: 24px; height: 24px; }

/* قائمة التسجيل السريع */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(14, 59, 67, .45); z-index: 50; display: none; }
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 51; background: var(--surface);
  border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(105%); visibility: hidden; transition: transform .22s ease, visibility .22s;
}
.sheet.open { transform: none; visibility: visible; }
.sheet-backdrop.open { display: block; }
.sheet h2 { margin-bottom: 12px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-grid a {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); font-size: .85rem;
  text-align: center; text-decoration: none;
}
.quick-grid a svg { width: 26px; height: 26px; }
.quick-grid a.fuel { background: var(--fuel-soft); border-color: #ecd3ad; color: var(--fuel-deep); }

/* القائمة الجانبية على الهاتف */
.drawer { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(300px, 86vw); z-index: 61;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-deep) 100%); color: #fff; transform: translateX(105%); visibility: hidden; transition: transform .22s ease, visibility .22s; overflow-y: auto; }
.drawer.open { transform: none; visibility: visible; }
/* في اللغات من اليسار لليمين تنزلق القائمة من اليسار */
[dir="ltr"] .drawer:not(.open) { transform: translateX(-105%); }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 60; display: none; }
.drawer-backdrop.open { display: block; }

.nav-group { padding: 14px 12px 4px; }
.nav-group .label { color: var(--nav-muted); font-size: .78rem; padding: 0 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--nav-text); text-decoration: none; font-size: .93rem; }
.nav-link:hover { background: rgba(255, 255, 255, .07); text-decoration: none; }
.nav-link.is-active { background: rgba(255, 255, 255, .12); color: #fff; font-weight: 600; }
.nav-link svg { width: 18px; height: 18px; opacity: .85; flex: none; }
.nav-foot { padding: 14px 22px 24px; color: var(--nav-muted); font-size: .82rem; border-top: 1px solid rgba(255,255,255,.1); margin-top: 12px; }
.nav-foot a { color: var(--nav-text); }
.nav-account { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 -10px 10px; border-radius: 8px; text-decoration: none; }
.nav-account:hover, .nav-account.is-active { background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav-account svg { width: 20px; height: 20px; flex: none; }
.nav-account span { color: #fff; font-size: .9rem; font-weight: 600; line-height: 1.3; }
.nav-account small { display: block; color: var(--nav-muted); font-weight: 400; font-size: .76rem; }
.nav-foot .logout { background: none; border: 0; padding: 0; margin-top: 10px; color: var(--nav-muted); font: inherit; font-size: .82rem; cursor: pointer; text-decoration: underline; }

/* مبدّل اللغة */
.lang-switch { display: flex; gap: 4px; flex-wrap: wrap; }
.lang-switch button { font: inherit; font-size: .8rem; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1px solid rgba(255, 255, 255, .25); color: var(--nav-text); }
.lang-switch button.is-active { background: #fff; border-color: #fff; color: var(--ink); font-weight: 600; }
.login-card .lang-switch { justify-content: flex-end; margin: -8px 0 14px; }
.login-card .lang-switch button { border-color: var(--line); color: var(--muted); }
.login-card .lang-switch button.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

.lang-choices { display: grid; gap: 10px; }
@media (min-width: 560px) { .lang-choices { grid-template-columns: repeat(3, 1fr); } }
.lang-choice { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  font: inherit; font-size: 1.05rem; color: var(--ink); cursor: pointer; text-align: start; }
.lang-choice:hover { border-color: var(--spring); }
.lang-choice.is-active { border: 2px solid var(--ink); padding: 11px 15px; font-weight: 600; }
.side-brand { padding: 18px 16px 8px; }
.side-logo { display: block; background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; text-align: center;
  border-bottom: 3px solid var(--leaf); box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.side-logo img { width: 132px; height: auto; display: inline-block; vertical-align: middle; }
.side-brand strong { display: block; font-size: 1.05rem; padding: 0 6px; }
.side-brand span { padding: 0 6px; }
.side-brand span { color: var(--nav-muted); font-size: .8rem; }

@media (min-width: 960px) {
  .app { grid-template-columns: 250px minmax(0, 1fr); }
  .sidebar { display: block; background: linear-gradient(180deg, var(--ink) 0%, var(--ink-deep) 100%); color: #fff; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .topbar, .bottomnav { display: none; }
  .main { padding: 28px 32px 48px; }
  h1 { font-size: 1.7rem; }
}

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--spring); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); }
.btn-fuel { background: var(--fuel); border-color: var(--fuel); color: #fff; }
.btn-fuel:hover { background: var(--fuel-deep); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 34px; padding: 4px 12px; font-size: .84rem; }
.icon-btn { background: none; border: 0; padding: 6px; cursor: pointer; display: grid; place-items: center; }
.icon-btn svg { width: 24px; height: 24px; }

/* ---------- الأقسام ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.panel-head a { font-size: .86rem; }
.panel-body { padding: 16px; }
.grid-2 { display: grid; gap: 18px; }
@media (min-width: 960px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2 > .panel { margin-bottom: 0; } .grid-2 { margin-bottom: 18px; } }

/* الأرقام الرئيسية: شريط متصل وليس بطاقات منفصلة */
.figures { display: grid; grid-template-columns: repeat(2, 1fr); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; box-shadow: var(--shadow); }
.figure { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.figure:nth-child(odd) { border-inline-end: 1px solid var(--line-soft); }
.figure .value, .tank-info .level { direction: inherit; }
.figure .value { font-size: 1.45rem; font-weight: 700; color: var(--ink); }
.figure .value small { font-size: .78rem; font-weight: 500; color: var(--muted); margin-inline-start: 4px; }
.figure .caption { color: var(--muted); font-size: .82rem; }
.figure.alert .value { color: var(--bad); }
.figure a { color: inherit; text-decoration: none; display: block; }
@media (min-width: 720px) {
  .figures { grid-template-columns: repeat(4, 1fr); }
  .figure { border-bottom: 0; border-inline-end: 1px solid var(--line-soft); }
  .figure:last-child { border-inline-end: 0; }
}

/* ---------- الخزانات (العنصر المميز) ---------- */
.tanks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 18px 24px; }
.tank { display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: end; text-decoration: none; color: inherit; }
.tank:hover { text-decoration: none; }
.tank-body {
  position: relative; height: 120px; border: 2px solid var(--ink); border-radius: 12px 12px 8px 8px;
  background: repeating-linear-gradient(to top, transparent 0 23px, var(--line-soft) 23px 24px);
  overflow: hidden;
}
.tank-body::before { content: ""; position: absolute; top: -2px; inset-inline-start: 50%; width: 16px; height: 6px;
  margin-inline-start: -8px; background: var(--ink); border-radius: 0 0 3px 3px; }
.tank-fill { position: absolute; inset-inline: 0; bottom: 0; background: linear-gradient(to top, var(--fuel-deep), var(--fuel));
  transition: height .8s ease; }
.tank-fill.oil { background: linear-gradient(to top, #4b3519, var(--oil)); }
.tank-fill.low { background: linear-gradient(to top, #8e1c16, var(--bad)); }
.tank-fill::after { content: ""; position: absolute; top: 0; inset-inline: 0; height: 3px; background: rgba(255,255,255,.45); }
.tank-info .name { font-weight: 600; color: var(--ink); font-size: .9rem; line-height: 1.35; }
.tank-info .level { font-size: 1.25rem; font-weight: 700; color: var(--fuel-deep); line-height: 1.2; }
.tank-info .level small { font-size: .75rem; color: var(--muted); font-weight: 500; }
.tank-info .cap { font-size: .78rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .tank-fill, .sheet, .drawer { transition: none; } }

/* ---------- القوائم والجداول ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: start; font-weight: 600; color: var(--muted); font-size: .8rem; padding: 10px 12px;
  border-bottom: 1px solid var(--line); background: #f5f9fc; white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 700; background: #f5f9fc; border-top: 1px solid var(--line); }
.table .end { text-align: end; }
.table-wrap { overflow-x: auto; }

/* على الهاتف: الصفوف تتحول إلى سطور مكدسة */
@media (max-width: 719px) {
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td, .table.stack tfoot { display: block; width: 100%; }
  .table.stack tr { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
  .table.stack td { border: 0; padding: 3px 0; display: block; text-align: end; overflow: hidden; }
  .table.stack td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; }
  [dir="rtl"] .table.stack td::before { float: right; margin-left: 12px; }
  [dir="ltr"] .table.stack td::before { float: left; margin-right: 12px; }
  .table.stack td.title-cell { display: block; text-align: start; font-weight: 600; font-size: .98rem; padding-bottom: 4px; }
  .table.stack td.title-cell::before { display: none; }
  .table.stack td:empty { display: none; }
  .table.stack td.end { text-align: end; }
}

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--line-soft); }
.list li:last-child { border-bottom: 0; }
.list .primary { font-weight: 600; color: var(--ink); }
.list .secondary { font-size: .82rem; color: var(--muted); }
.list a.row-link { display: flex; justify-content: space-between; gap: 12px; width: 100%; color: inherit; text-decoration: none; }

/* الوسوم */
.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600;
  background: var(--line-soft); color: var(--muted); white-space: nowrap; }
.tag.in { background: var(--ok-soft); color: var(--ok); }
.tag.out { background: var(--bad-soft); color: var(--bad); }
.tag.transfer { background: var(--spring-soft); color: var(--ink-2); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.fuel { background: var(--fuel-soft); color: var(--fuel-deep); }
.qty-in { color: var(--ok); font-weight: 600; }
.qty-out { color: var(--bad); font-weight: 600; }

/* أشرطة المقارنة */
.bars { display: grid; gap: 12px; }
.bar-row .bar-label { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; margin-bottom: 4px; }
.bar-track { height: 10px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--ink-2); border-radius: 999px; }
.bar-fill.fuel { background: var(--fuel); }

/* التنبيهات */
.alerts li { align-items: flex-start; }
.alert-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); flex: none; margin-top: 8px; }
.alert-dot.bad { background: var(--bad); }
.alert-line { flex: 1; }

/* الرسائل */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 8px; font-weight: 500; }
.messages .success { background: var(--ok-soft); color: var(--ok); }
.messages .error { background: var(--bad-soft); color: var(--bad); }
.messages .info, .messages .warning { background: var(--warn-soft); color: var(--warn); }

/* ---------- النماذج ---------- */
.form-card { max-width: 720px; }
.form-grid { display: grid; gap: 14px 16px; }
@media (min-width: 720px) { .form-grid { grid-template-columns: 1fr 1fr; } .field.wide { grid-column: 1 / -1; } }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; color: var(--ink); }
.field .req { color: var(--bad); }
.field input:not([type=checkbox]), .field select, .field textarea, .filters input, .filters select, .report-list input, .report-list select {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; font: inherit; font-size: 16px; color: var(--text);
}
.field textarea { min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus, .filters input:focus, .filters select:focus {
  outline: none; border-color: var(--spring); box-shadow: 0 0 0 3px var(--spring-soft); }
.field .help { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.field .errors { color: var(--bad); font-size: .84rem; margin-top: 4px; font-weight: 500; }
.field.has-error input, .field.has-error select { border-color: var(--bad); }
.field.check-field { display: flex; align-items: center; gap: 10px; }
.field.check-field label { margin: 0; }
input.check { width: 22px; height: 22px; accent-color: var(--ink); }
.field.hidden { display: none; }
.form-errors { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.hint-box { background: var(--spring-soft); color: var(--ink); padding: 10px 14px; border-radius: var(--radius-sm); font-size: .88rem; margin-bottom: 14px; }
.hint-box.fuel { background: var(--fuel-soft); color: var(--fuel-deep); }

/* الفلاتر */
.filters { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); align-items: end; }
.filters .wide { grid-column: 1 / -1; }
.filters label { font-size: .78rem; color: var(--muted); display: block; margin-bottom: 3px; }
@media (min-width: 720px) { .filters { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } .filters .wide { grid-column: auto; } }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); scrollbar-width: none; }
.chips a { flex: none; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: .85rem; text-decoration: none; }
.chips a.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* تفاصيل */
.details { display: grid; grid-template-columns: 1fr; margin: 0; }
.details > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.details dt { color: var(--muted); font-size: .86rem; }
.details dd { margin: 0; font-weight: 500; text-align: end; }
@media (min-width: 720px) { .details { grid-template-columns: 1fr 1fr; } .details > div:nth-child(odd) { border-inline-end: 1px solid var(--line-soft); } }
.photo-thumb { max-width: 100%; max-height: 260px; border-radius: var(--radius-sm); border: 1px solid var(--line); }

.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 12px; }

.pagination { display: flex; gap: 8px; justify-content: center; padding: 14px; align-items: center; }

/* ---------- تسجيل الدخول ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(170deg, var(--ink-deep) 0, var(--ink) 30%, var(--sky) 44%, var(--leaf) 44%, var(--leaf) 46%, var(--paper) 46%); }
.login-logo { display: block; width: 190px; height: auto; margin: 0 auto 14px; }
.login-card h1 { text-align: center; }
.login-card p.muted { text-align: center; }
.login-card { width: min(400px, 100%); background: var(--surface); border-radius: 14px; padding: 28px 24px; box-shadow: 0 20px 50px rgba(8,56,119,.28); border-top: 4px solid var(--leaf); }
.login-card h1 { margin-bottom: 4px; }
.login-card p.muted { margin: 0 0 20px; }

/* ---------- التقارير والطباعة ---------- */
.report-head { border-bottom: 3px solid var(--ink); padding-bottom: 12px; margin-bottom: 16px; position: relative; }
.report-head::after { content: ""; position: absolute; inset-inline: 0; bottom: -6px; height: 2px; background: var(--leaf); }
.report-logo { float: inline-end; width: 96px; height: auto; margin-inline-start: 12px; }
.report-head .company { color: var(--muted); font-size: .9rem; }
.report-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.report-list li { padding: 14px 16px; }
.report-list form { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-top: 10px; }
.report-list form .wide { grid-column: 1 / -1; }
.report-list form .btns { grid-column: 1 / -1; display: flex; gap: 8px; }
.report-list li { display: block; }
@media (min-width: 720px) { .report-list form { grid-template-columns: repeat(4, 1fr) auto; align-items: end; } .report-list form .wide { grid-column: auto; } .report-list form .btns { grid-column: auto; } }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 11px; }
  .sidebar, .topbar, .bottomnav, .no-print, .sheet, .drawer, .messages { display: none !important; }
  .app { display: block; }
  .main { padding: 0; max-width: none; }
  .panel { box-shadow: none; border: 0; }
  .table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table td, .table th { padding: 5px 6px; }
  .table.stack { display: table !important; }
  .table.stack thead { display: table-header-group !important; }
  .table.stack tbody { display: table-row-group !important; }
  .table.stack tfoot { display: table-footer-group !important; }
  .table.stack tr { display: table-row !important; }
  .table.stack td { display: table-cell !important; }
  .table.stack td::before { display: none !important; }
  .table.stack td.title-cell { display: table-cell !important; }
  .report-head { display: block; }
  a { color: inherit; }
}

/* ---------- الفريق: المهام والساعات الإضافية ---------- */
.task-list li.is-late { box-shadow: inset 3px 0 0 var(--bad); }
[dir="rtl"] .task-list li.is-late { box-shadow: inset -3px 0 0 var(--bad); }
.task-main { min-width: 0; flex: 1; }
.task-list .row-link { align-items: center; }
.prio { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 7px; vertical-align: middle; }
.prio-urgent { background: var(--bad); }
.prio-high { background: var(--warn); }
.late { color: var(--bad); font-weight: 600; }
.mini-track { height: 4px; background: var(--line-soft); border-radius: 999px; margin-top: 6px; overflow: hidden; max-width: 220px; }
.mini-track > div { height: 100%; background: var(--spring); }
.bar-fill.over { background: var(--bad); }
.month-nav { display: flex; align-items: center; gap: 12px; margin: -6px 0 14px; }
.month-nav strong { color: var(--ink); min-width: 9em; text-align: center; }
.bulk-bar { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); background: #f5f9fc; }
.prewrap { white-space: pre-wrap; }
.timeline li { align-items: flex-start; }
fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { font-weight: 600; font-size: .88rem; color: var(--ink); margin-bottom: 8px; padding: 0; }
.chips-input { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip-check span { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: .9rem; color: var(--muted); background: #fff; }
.chip-check input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.chip-check input:focus-visible + span { outline: 3px solid var(--spring); outline-offset: 2px; }
.quick-grid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 380px) { .quick-grid { grid-template-columns: repeat(3, 1fr); } }
[dir="rtl"] .month-nav .btn { transform: scaleX(-1); }
.panel-head .actions { gap: 14px; }

/* ---------- كشوف الساعات الإضافية للطباعة ---------- */
.sheet-filters { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.print-sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; margin-bottom: 22px; box-shadow: var(--shadow); }
.sheet-id { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; margin: 0 0 16px; }
.sheet-id div { border-bottom: 1px solid var(--line-soft); padding-bottom: 6px; }
.sheet-id dt { color: var(--muted); font-size: .8rem; }
.sheet-id dd { margin: 0; font-weight: 600; color: var(--ink); }
@media (min-width: 720px) { .sheet-id { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sheet-table { font-size: .86rem; }
.sheet-table td, .sheet-table th { padding: 7px 8px; }
.sheet-table tr.day-off td { background: var(--warn-soft); }
.table-scroll, .print-sheet { overflow-x: auto; }
.sheet-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.sheet-summary div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.sheet-summary .total { border-color: var(--ink); background: var(--spring-soft); }
@media (min-width: 720px) { .sheet-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.signatures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 34px; }
.signatures div { border-top: 1px solid var(--text); padding-top: 6px; text-align: center; font-size: .85rem; color: var(--muted); min-height: 56px; }
.print-footer { margin-top: 18px; padding-top: 8px; border-top: 1px solid var(--line-soft); font-size: .72rem; color: var(--muted); text-align: center; }
.copyright strong { font-weight: 600; unicode-bidi: isolate; }
@media print {
  .print-sheet { border: 0; box-shadow: none; padding: 0; margin: 0; break-after: page; page-break-after: always; }
  .print-sheet:last-of-type { break-after: auto; page-break-after: auto; }
  .sheet-table tr.day-off td { background: #f3f3f3 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sheet-id { grid-template-columns: repeat(4, 1fr); }
  .sheet-summary { grid-template-columns: repeat(4, 1fr); }
  .sheet-table { display: table !important; }
}

/* ---------- لوحة مراقبة النظام ---------- */
.nav-owner { border: 1px dashed rgba(255, 255, 255, .25); margin-top: 6px; }
.nav-copy { margin-top: 14px; font-size: .7rem; line-height: 1.5; color: var(--nav-muted); }
.console-tabs { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.spark { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 150px; }
.spark-col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.spark-bar { position: relative; flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; }
.spark-bar span { display: block; width: 100%; border-radius: 3px 3px 0 0; min-height: 0; }
.spark-bar .v, .legend i.v { background: var(--spring-soft); }
.spark-bar .c, .legend i.c { background: var(--ink-2); }
.spark-col small { color: var(--muted); font-size: .68rem; }
.legend { display: flex; gap: 16px; margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 6px; vertical-align: middle; }
.tag.act-create { background: var(--ok-soft); color: var(--ok); }
.tag.act-update { background: var(--spring-soft); color: var(--ink-2); }
.tag.act-delete, .tag.act-login_failed, .tag.act-denied { background: var(--bad-soft); color: var(--bad); }
.tag.act-login, .tag.act-logout { background: var(--warn-soft); color: var(--warn); }
.tag.act-export { background: var(--fuel-soft); color: var(--fuel-deep); }
.change-hint { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-weight: 400; color: var(--muted); }
.change-hint del { color: var(--bad); }
.change-hint b { color: var(--ok); font-weight: 600; }
.log-table code, .details code { font-size: .78rem; background: #f1f6fa; padding: 1px 6px; border-radius: 4px; word-break: break-all; }
tr.is-disabled td { opacity: .6; }
.user-actions form { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.app-footer { text-align: center; font-size: .74rem; color: var(--muted); padding: 18px 0 4px; }
.login-card .app-footer { padding-bottom: 0; margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
@media (min-width: 960px) { .main > .app-footer { display: none; } }
.sheet-table td.num, .sheet-table td:first-child { white-space: nowrap; }

/* ---------- المشتريات ---------- */
.select-search { width: 100%; margin-bottom: 6px; padding: 9px 12px; border: 1px dashed var(--line); border-radius: var(--radius-sm); font: inherit; background: var(--paper); }
.money-list { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.figure .value .money-list { font-size: 1.15rem; }
.figure .value .money-list small { margin-inline-start: 2px; }
.steps { display: flex; gap: 4px; padding: 14px 16px; overflow-x: auto; list-style: none; margin: 0; }
.steps li { flex: 1 1 0; min-width: 0; text-align: center; font-size: .76rem; color: var(--muted); position: relative; padding-top: 18px; }
.steps li::before { content: ""; position: absolute; top: 4px; inset-inline: 0; height: 4px; border-radius: 4px; background: var(--line); }
.steps li.done::before { background: var(--spring); }
.steps li.current { color: var(--ink); font-weight: 700; }
.steps li.current::before { background: var(--ink); }
.attach-preview { display: block; max-width: 100%; max-height: 420px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 auto; }
.inline-forms { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-forms form { margin: 0; }
.status-pending { background: var(--warn-soft); color: var(--warn); }
.status-approved { background: var(--spring-soft); color: var(--ink-2); }
.status-paid { background: var(--ok-soft); color: var(--ok); }
.status-rejected { background: var(--bad-soft); color: var(--bad); }
.check-cell { width: 34px; }
.phone-done td { color: var(--muted); }
@media print {
  .print-only { display: block !important; }
  .signatures.print-only { display: grid !important; }
  .chips, .select-search { display: none !important; }
}

.topbar-mark { width: 34px; height: 34px; background: #fff; border-radius: 50%; padding: 3px; flex: none; }
.nav-link.is-active { box-shadow: inset 3px 0 0 var(--leaf); }
[dir="rtl"] .nav-link.is-active { box-shadow: inset -3px 0 0 var(--leaf); }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.fab .circle, .bottomnav .fab .circle { background: linear-gradient(135deg, var(--sky), var(--ink)); }
.role-cards { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .role-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.role-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.role-card:has(input:checked) { border: 2px solid var(--ink); padding: 11px 13px; background: var(--spring-soft); }
.role-card input { margin-top: 5px; }
.role-card strong { display: block; color: var(--ink); }
.role-card small { display: block; font-size: .8rem; }
.check-line { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.chip-check input:disabled + span { opacity: .75; }

.period-picker { display: contents; }
.period-picker [hidden] { display: none !important; }
.period-form { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; margin-bottom: 16px;
  background: var(--surface); padding: 12px 14px; border-radius: var(--radius); box-shadow: var(--shadow); }
@media (min-width: 720px) { .period-form { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.period-form label { display: block; margin-bottom: 3px; }
.period-form input, .period-form select { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: #fff; }

.supplier-photo { display: block; width: 100%; max-height: 220px; object-fit: cover; border-bottom: 1px solid var(--line-soft); }

.paste-zone { margin-top: 8px; border: 2px dashed var(--line); border-radius: var(--radius-sm); padding: 12px; text-align: center;
  color: var(--muted); font-size: .85rem; cursor: text; background: var(--paper); }
.paste-zone:focus { outline: none; border-color: var(--spring); background: var(--spring-soft); }
.paste-zone.drag { border-color: var(--leaf); background: var(--ok-soft); }
.paste-zone img { display: block; max-width: 100%; max-height: 180px; margin: 8px auto 0; border-radius: 4px; }
.paste-zone.has-image span { display: none; }
/* معرض الأصناف والأصول */
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.view-toggle a { padding: 8px 14px; color: var(--muted); font-size: .85rem; text-decoration: none; }
.view-toggle a.is-active { background: var(--ink); color: #fff; }
.gallery { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px; }
@media (min-width: 720px) { .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .gallery { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.g-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--surface); color: inherit; text-decoration: none; }
.g-card:hover { border-color: var(--spring); text-decoration: none; }
.g-photo { aspect-ratio: 1 / 1; background: var(--paper); display: grid; place-items: center; }
.g-photo img { width: 100%; height: 100%; object-fit: cover; }
.g-photo svg { width: 42px; height: 42px; color: var(--line); }
.g-body { padding: 8px 10px 10px; display: grid; gap: 2px; }
.g-name { font-weight: 600; color: var(--ink); font-size: .9rem; line-height: 1.35; }
.g-code { font-size: .76rem; color: var(--muted); }
.g-qty { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.g-card.low { border-color: var(--warn); }
.item-photo { display: block; width: 100%; max-height: 260px; object-fit: contain; background: var(--paper); border-bottom: 1px solid var(--line-soft); }
.row-thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; vertical-align: middle; margin-inline-end: 8px; border: 1px solid var(--line-soft); }
.otp-input { font-size: 1.6rem !important; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.otp-qr { display: block; margin: 8px auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.otp-steps { padding-inline-start: 20px; margin: 8px 0; font-size: .92rem; }
.otp-secret { word-break: break-all; }
