/* ═══════════════════════════════════════════════════════════════
   نسيج — نظام التصميم
   ستايل كرتوني مرح: حواف دائرية، ظلال «ستيكر»، ألوان مبهجة، حركات خفيفة.
   ═══════════════════════════════════════════════════════════════ */

@font-face { font-family: "Tajawal"; src: url("../fonts/Tajawal-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Tajawal"; src: url("../fonts/Tajawal-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Tajawal"; src: url("../fonts/Tajawal-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Tajawal"; src: url("../fonts/Tajawal-ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Baloo"; src: url("../fonts/BalooBhaijaan2.ttf") format("truetype"); font-weight: 400 800; font-display: swap; }

:root {
  --ink: #2D3436;
  --ink-2: #4B4B6B;
  --muted: #8A8FA8;
  --line: #E7E4F7;
  --bg: #F5F3FF;
  --card: #FFFFFF;
  --primary: #6C5CE7;
  --primary-2: #8E7CFF;
  --primary-soft: #EEEBFF;
  --mint: #00B894;
  --mint-soft: #E0FBF3;
  --coral: #E17055;
  --coral-soft: #FFEDE7;
  --sky: #0984E3;
  --sky-soft: #E3F2FF;
  --sun: #FDCB6E;
  --sun-soft: #FFF6DE;
  --pink: #FD79A8;
  --red: #D63031;
  --red-soft: #FFE5E5;
  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 2px 0 rgba(45, 52, 54, .05), 0 10px 30px -12px rgba(108, 92, 231, .25);
  --sticker: 0 4px 0 rgba(45, 52, 54, .10);
  --rail: 108px;
  --rail-open: 268px;
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --font-fun: "Baloo", "Tajawal", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; min-width: 1100px;
}
body::before {
  /* فقاعات خلفية هادية */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    radial-gradient(600px 400px at 95% -5%, rgba(108,92,231,.13), transparent 60%),
    radial-gradient(500px 380px at -5% 105%, rgba(0,184,148,.11), transparent 60%),
    radial-gradient(420px 300px at 50% 120%, rgba(253,203,110,.14), transparent 60%);
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-2); }
h1, h2, h3, h4 { font-family: var(--font-fun); margin: 0; line-height: 1.25; font-weight: 700; }
input, select, textarea, button { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: var(--primary); color: #fff; }

.ic { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: -.25em; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-lg { width: 1.7em; height: 1.7em; }
.ic-xl { width: 2.4em; height: 2.4em; }

/* ═════════════ الهيكل: شريط أيقونات جانبي + محتوى ═════════════ */
.app { display: flex; min-height: 100vh; }
.rail {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--rail); z-index: 40;
  background: linear-gradient(180deg, #2A2153 0%, #3B2F7A 100%);
  display: flex; flex-direction: column; padding: 14px 0; transition: width .35s var(--ease-bounce);
  box-shadow: -6px 0 30px -10px rgba(42,33,83,.5);
}
.rail-open .rail { width: var(--rail-open); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 18px 14px; color: #fff; white-space: nowrap; overflow: hidden; }
.brand-logo {
  width: 52px; height: 52px; border-radius: 16px; flex-shrink: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, #FDCB6E, #FD79A8); box-shadow: 0 4px 0 rgba(0,0,0,.25);
  animation: wobble 6s ease-in-out infinite;
}
.brand-logo svg { width: 36px; height: 36px; }
.brand-text { opacity: 0; transition: opacity .2s; }
.rail-open .brand-text { opacity: 1; }
.brand-text b { font-family: var(--font-fun); font-size: 23px; display: block; line-height: 1; }
.brand-text small { color: #C9C2FF; font-size: 12px; }
.rail nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 12px; scrollbar-width: none; }
.rail nav::-webkit-scrollbar { display: none; }
.rail-group { color: #9C92D9; font-size: 11px; font-weight: 700; padding: 10px 10px 4px; white-space: nowrap; opacity: 0; height: 0; overflow: hidden; transition: opacity .2s; }
.rail-open .rail-group { opacity: 1; height: auto; }
.rail-link {
  position: relative; display: flex; align-items: center; gap: 12px; color: #E2DDFF; border-radius: 16px;
  padding: 8px; margin: 3px 0; white-space: nowrap; transition: background .2s, transform .2s var(--ease-bounce);
}
.rail-link .tile {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0;
  background: color-mix(in srgb, var(--c, #6C5CE7) 30%, transparent); color: #fff;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); transition: transform .25s var(--ease-bounce), background .2s;
}
.rail-link .tile .ic { width: 24px; height: 24px; }
.rail-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.rail-link:hover .tile { transform: scale(1.1) rotate(-6deg); background: var(--c); }
.rail-link.active { background: rgba(255,255,255,.12); color: #fff; }
.rail-link.active .tile { background: var(--c); box-shadow: 0 4px 0 rgba(0,0,0,.25), 0 0 0 3px rgba(255,255,255,.16); }
.rail-link .label { flex: 1; font-weight: 700; opacity: 0; transition: opacity .2s; }
.rail-link .label small { display: block; font-weight: 500; font-size: 11.5px; color: #B7AEF5; margin-top: -3px; }
.rail-open .rail-link .label { opacity: 1; }
/* الوضع المصغّر: الاسم تحت الأيقونة دايمًا (مش أيقونة لوحدها) */
body:not(.rail-open) .rail nav { padding: 4px 8px; }
body:not(.rail-open) .rail-link { flex-direction: column; gap: 4px; padding: 7px 2px 6px; text-align: center; }
body:not(.rail-open) .rail-link .label { opacity: 1; flex: none; font-size: 11.5px; line-height: 1.25; white-space: normal; font-weight: 700; color: #E2DDFF; }
body:not(.rail-open) .rail-link .label small { display: none; }
body:not(.rail-open) .rail-link .tile { width: 42px; height: 42px; }
body:not(.rail-open) .rail-link .rail-badge { left: 10px; top: 0; }
body:not(.rail-open) .rail-group { opacity: 1; height: auto; text-align: center; font-size: 10.5px; padding: 8px 2px 2px; border-top: 1px solid rgba(255,255,255,.08); margin-top: 4px; }
body:not(.rail-open) .rail-group:first-child { border-top: 0; margin-top: 0; }
.rail-badge {
  position: absolute; top: 2px; left: 4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--bc, #FD79A8); color: #fff; font-size: 11.5px; font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 2px 0 rgba(0,0,0,.25); border: 2px solid #2F2564; font-family: var(--font-fun); direction: ltr;
  animation: pop .5s var(--ease-bounce) both;
}
.rail-badge.zero { display: none; }
.rail-tip {
  position: absolute; right: calc(100% + 14px); top: 50%; transform: translateY(-50%) translateX(8px) scale(.9);
  background: #fff; color: var(--ink); padding: 8px 12px; border-radius: 12px; font-weight: 700; font-size: 13px;
  white-space: nowrap; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: all .2s var(--ease-bounce); z-index: 60;
}
.rail-tip small { display: block; color: var(--muted); font-weight: 500; }
.rail-link:hover .rail-tip { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
.rail-tip { display: none; }
.rail-open .rail-tip { display: none; }
.rail-toggle {
  margin: 8px 18px 0; height: 42px; border-radius: 14px; border: 0; cursor: pointer; color: #E2DDFF;
  background: rgba(255,255,255,.08); display: flex; align-items: center; justify-content: center; gap: 8px; transition: background .2s;
}
.rail-toggle:hover { background: rgba(255,255,255,.16); }
.rail-toggle .ic { transition: transform .35s var(--ease-bounce); }
.rail-open .rail-toggle .ic { transform: rotate(180deg); }

.main { flex: 1; margin-right: var(--rail); transition: margin .35s var(--ease-bounce); min-width: 0; }
.rail-open .main { margin-right: var(--rail-open); }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 28px;
  background: rgba(245,243,255,.82); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(231,228,247,.7);
}
.global-search { position: relative; flex: 1; max-width: 520px; }
.global-search input {
  width: 100%; height: 46px; border-radius: 15px; border: 2px solid var(--line); background: #fff; padding: 0 46px 0 70px;
  transition: border-color .2s, box-shadow .2s;
}
.global-search input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 5px var(--primary-soft); }
.global-search > .ic { position: absolute; right: 15px; top: 13px; color: var(--muted); }
.global-search kbd { position: absolute; left: 12px; top: 11px; }
kbd { background: var(--primary-soft); color: var(--primary); border-radius: 7px; padding: 1px 8px; font-size: 12px; font-family: var(--font-fun); border-bottom: 2px solid #D9D3FF; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.quick-btn { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 14px; border-radius: 16px; background: #fff;
  border: 2px solid var(--line); cursor: pointer;
}
.avatar {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--pink)); font-family: var(--font-fun);
}
.user-chip b { display: block; font-size: 13.5px; line-height: 1.2; }
.user-chip small { color: var(--muted); font-size: 11.5px; }
.content { padding: 24px 28px 60px; max-width: 1600px; }

/* ═════════════ عناوين الصفحات ═════════════ */
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-icon {
  width: 60px; height: 60px; border-radius: 19px; display: grid; place-items: center; color: #fff; flex-shrink: 0;
  background: var(--c, var(--primary)); box-shadow: 0 5px 0 color-mix(in srgb, var(--c, var(--primary)) 65%, #000);
  animation: bounce-in .6s var(--ease-bounce) both;
}
.page-icon .ic { width: 30px; height: 30px; }
.page-head h1 { font-size: 28px; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.page-actions { margin-right: auto; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }

/* ═════════════ كروت ═════════════ */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(231,228,247,.8);
  padding: 20px; position: relative;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 18px; }
.card-head .ic { color: var(--c, var(--primary)); }
.card-head .more { margin-right: auto; font-size: 13px; font-weight: 700; }
.card-flat { box-shadow: none; }
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 18px; }
.mb { margin-bottom: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-family: var(--font-fun); font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* بطاقات الإحصاء */
.stat {
  --c: var(--primary); display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: var(--radius);
  background: #fff; box-shadow: var(--shadow); border: 1px solid rgba(231,228,247,.8); position: relative; overflow: hidden;
  transition: transform .25s var(--ease-bounce);
}
.stat:hover { transform: translateY(-4px) rotate(-.4deg); }
.stat::after {
  content: ""; position: absolute; left: -30px; bottom: -40px; width: 120px; height: 120px; border-radius: 50%;
  background: color-mix(in srgb, var(--c) 10%, transparent);
}
.stat .tile {
  width: 56px; height: 56px; border-radius: 17px; display: grid; place-items: center; color: #fff; flex-shrink: 0;
  background: var(--c); box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 65%, #000);
}
.stat .tile .ic { width: 28px; height: 28px; }
.stat .v { font-family: var(--font-fun); font-size: 30px; font-weight: 800; line-height: 1.05; }
.stat .v small { font-size: 14px; color: var(--muted); font-weight: 600; margin-right: 4px; }
.stat .l { color: var(--muted); font-size: 13.5px; font-weight: 500; }
.stat .sub { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }

/* ═════════════ أزرار ═════════════ */
.btn {
  --c: var(--primary); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: 14px; border: 0; cursor: pointer; font-weight: 700; color: #fff; background: var(--c);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 62%, #000); transition: transform .12s, box-shadow .12s, filter .2s;
  white-space: nowrap; user-select: none; text-decoration: none;
}
.btn:hover { filter: brightness(1.07); color: #fff; transform: translateY(-1px); box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 62%, #000); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 62%, #000); }
.btn:disabled, .btn.disabled { opacity: .55; pointer-events: none; }
.btn-mint { --c: var(--mint); }
.btn-coral { --c: var(--coral); }
.btn-sky { --c: var(--sky); }
.btn-red { --c: var(--red); }
.btn-sun { --c: #F0B429; }
.btn-ghost {
  background: #fff; color: var(--ink); box-shadow: 0 3px 0 var(--line); border: 2px solid var(--line);
}
.btn-ghost:hover { color: var(--primary); border-color: #D6D0FF; box-shadow: 0 4px 0 #D6D0FF; }
.btn-ghost:active { box-shadow: 0 0 0 var(--line); }
.btn-soft { background: var(--primary-soft); color: var(--primary); box-shadow: 0 3px 0 #DAD4FF; }
.btn-soft:hover { color: var(--primary); }
.btn-sm { height: 36px; padding: 0 12px; border-radius: 11px; font-size: 13.5px; }
.btn-lg { height: 54px; padding: 0 26px; font-size: 17px; border-radius: 17px; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 34px; }
.btn .ic { width: 20px; height: 20px; }
.btn-xl { height: 64px; font-size: 19px; padding: 0 34px; border-radius: 20px; }
.btn.loading { pointer-events: none; position: relative; color: transparent !important; }
.btn.loading::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4);
  border-top-color: #fff; animation: spin .7s linear infinite;
}
.btn-ghost.loading::after { border-color: var(--line); border-top-color: var(--primary); }

/* ═════════════ نماذج ═════════════ */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl { font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.field > label .req { color: var(--coral); }
.hint { color: var(--muted); font-size: 12.5px; }
.input, .select, textarea.input {
  width: 100%; height: 46px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: #fff; padding: 0 14px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
textarea.input { height: auto; min-height: 80px; padding: 10px 14px; resize: vertical; }
.input:focus, .select:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 5px var(--primary-soft); }
.input.input-lg { height: 54px; font-size: 18px; }
.input-error, .input-validation-error { border-color: var(--coral) !important; background: #FFF8F6; }
.field-validation-error, .text-error { color: var(--coral); font-size: 12.5px; font-weight: 700; }
.validation-summary-errors ul { margin: 0; padding: 0 18px; }
.select { appearance: none; padding-left: 36px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236C5CE7' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat 12px center; }
.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .col-2 { grid-column: span 2; }
.form-grid .col-3 { grid-column: span 3; }
.form-grid .col-4 { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 700; user-select: none; }
.check input { appearance: none; width: 24px; height: 24px; border-radius: 8px; border: 2px solid #CFC9F5; background: #fff; display: grid; place-items: center; transition: all .2s var(--ease-bounce); cursor: pointer; margin: 0; }
.check input::after { content: ""; width: 7px; height: 12px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) scale(0); margin-top: -3px; transition: transform .2s var(--ease-bounce); }
.check input:checked { background: var(--mint); border-color: var(--mint); box-shadow: 0 3px 0 #00876C; }
.check input:checked::after { transform: rotate(45deg) scale(1); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; }
.switch input { appearance: none; width: 50px; height: 28px; border-radius: 14px; background: #DFDCF2; position: relative; cursor: pointer; transition: background .25s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .3s var(--ease-bounce); }
.switch input:checked { background: var(--mint); }
.switch input:checked::after { transform: translateX(-22px); }
.seg { display: inline-flex; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 3px; gap: 3px; }
.seg a, .seg button, .seg label { border: 0; background: transparent; padding: 6px 14px; border-radius: 10px; font-weight: 700; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg .on, .seg input:checked + span { background: var(--primary); color: #fff; box-shadow: 0 3px 0 #4B3DB8; }
.seg input { display: none; }
.seg label span { padding: 6px 12px; border-radius: 10px; display: inline-flex; align-items: center; gap: 6px; }
.seg label { padding: 0; }

/* ═════════════ الفلاتر ═════════════ */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px; margin-bottom: 18px; }
.filters .field { min-width: 160px; flex: 1; }
.filters .field.grow { flex: 2.4; min-width: 260px; }
.search-box { position: relative; }
.search-box .ic { position: absolute; right: 14px; top: 13px; color: var(--muted); pointer-events: none; }
.search-box .input { padding-right: 44px; }
.search-box .spinner { position: absolute; left: 14px; top: 14px; display: none; }
.search-box.busy .spinner { display: block; }

/* ═════════════ جداول ═════════════ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th {
  text-align: right; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 11px 14px; background: #FAF9FF;
  border-bottom: 2px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid #F1EFFA; vertical-align: middle; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: #FBFAFF; }
.tbl tr.muted td { color: #B2BEC3; }
.tbl tr.row-group td { background: #F1F0F9; font-weight: 800; }
.tbl tr.row-subtotal td { background: #F6F4FF; font-weight: 800; color: var(--primary); }
.tbl tfoot td { background: #FFF6DE; font-weight: 800; border-top: 2px solid #FCE6A9; }
.tbl .c { text-align: center; }
.tbl .n { text-align: center; font-family: var(--font-fun); font-weight: 600; direction: ltr; }
.tbl .acts { white-space: nowrap; text-align: left; }
.tbl a.title { font-weight: 800; color: var(--ink); }
.tbl a.title:hover { color: var(--primary); }
.tbl-compact td, .tbl-compact th { padding: 8px 10px; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main small { display: block; color: var(--muted); font-size: 12px; }

/* ═════════════ شارات ═════════════ */
.badge {
  --c: var(--primary); display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800;
  color: color-mix(in srgb, var(--c) 82%, #000); background: color-mix(in srgb, var(--c) 15%, #fff); white-space: nowrap;
}
.badge .ic { width: 14px; height: 14px; }
.st-ok { --c: #00B894; }
.st-cancel { --c: #D63031; text-decoration: line-through; }
.st-draft { --c: #8A8FA8; }
.st-counting { --c: #0984E3; }
.st-review { --c: #E1A100; }
.st-approved { --c: #00B894; }
.st-cancelled { --c: #D63031; }
.lvl { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.lvl i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent); }
.lvl-out { color: #C0392B; background: #FFE5E5; }
.lvl-out i { animation: pulse 1.4s infinite; }
.lvl-critical { color: #D35400; background: #FFEDE4; }
.lvl-critical i { animation: pulse 1.8s infinite; }
.lvl-low { color: #B7860B; background: #FFF4D6; }
.lvl-normal { color: #00876C; background: #E0FBF3; }
.lvl-over { color: #0767B1; background: #E3F2FF; }
.swatch { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; white-space: nowrap; }
.swatch i, .dot { width: 18px; height: 18px; border-radius: 6px; background: var(--c); border: 2px solid rgba(45,52,54,.15); box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); display: inline-block; flex-shrink: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; }
.swatch b { font-family: var(--font-fun); color: var(--muted); font-weight: 600; margin-right: 2px; }
.color-strip { display: inline-flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.color-strip i { width: 15px; height: 15px; border-radius: 5px; background: var(--c); border: 1.5px solid rgba(45,52,54,.15); transition: transform .2s var(--ease-bounce); }
.color-strip i:hover { transform: scale(1.5); z-index: 2; }
.color-strip b { font-size: 11.5px; color: var(--muted); margin-right: 3px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 12px; background: #F3F1FF; font-weight: 700; font-size: 13px; }

/* صور الأصناف */
.thumb { border-radius: 14px; object-fit: cover; flex-shrink: 0; background: #F3F1FF; border: 2px solid #fff; box-shadow: 0 3px 0 rgba(45,52,54,.08); }
.thumb-sm { width: 40px; height: 40px; border-radius: 11px; }
.thumb-md { width: 54px; height: 54px; }
.thumb-lg { width: 100%; aspect-ratio: 4/3; height: auto; border-radius: 18px; }
.thumb-xl { width: 220px; height: 220px; border-radius: 26px; }
.thumb-empty {
  display: grid; place-items: center; color: #fff; font-family: var(--font-fun); font-weight: 800; font-size: 1.3em;
  background: linear-gradient(135deg, hsl(var(--h) 75% 68%), hsl(calc(var(--h) + 40) 80% 60%));
}
.thumb-sm.thumb-empty { font-size: 17px; }
.thumb-lg.thumb-empty, .thumb-xl.thumb-empty { font-size: 70px; }

/* ═════════════ كروت الأصناف ═════════════ */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.item-card {
  background: #fff; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid rgba(231,228,247,.8);
  display: flex; flex-direction: column; transition: transform .3s var(--ease-bounce), box-shadow .3s; position: relative;
  animation: rise .5s var(--ease-bounce) both; animation-delay: calc(var(--i, 0) * 35ms);
}
.item-card:hover { transform: translateY(-6px) rotate(-.6deg); box-shadow: 0 18px 40px -14px rgba(108,92,231,.45); }
.item-card .pic { position: relative; aspect-ratio: 16/10; background: #F3F1FF; overflow: hidden; }
.item-card .pic img, .item-card .pic .thumb { width: 100%; height: 100%; border-radius: 0; border: 0; box-shadow: none; object-fit: cover; transition: transform .5s; }
.item-card:hover .pic img { transform: scale(1.06); }
.item-card .pic .thumb-empty { font-size: 64px; }
.item-card .pic .lvl { position: absolute; top: 10px; right: 10px; box-shadow: 0 3px 0 rgba(0,0,0,.08); }
.item-card .pic .code { position: absolute; bottom: 10px; left: 10px; background: rgba(45,52,54,.75); color: #fff; padding: 1px 9px; border-radius: 9px; font-family: var(--font-fun); font-size: 12.5px; }
.item-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.item-card h4 { font-size: 17.5px; color: var(--ink); }
.item-card .meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.item-card .qty-row { display: flex; align-items: flex-end; gap: 12px; margin-top: auto; padding-top: 8px; border-top: 2px dashed #F0EEFA; }
.item-card .qty { font-family: var(--font-fun); font-size: 26px; font-weight: 800; line-height: 1; color: var(--ink); }
.item-card .qty small { font-size: 13px; color: var(--muted); font-weight: 600; }
.item-card .sets { margin-right: auto; text-align: center; background: var(--primary-soft); color: var(--primary); border-radius: 13px; padding: 4px 11px; }
.item-card .sets b { display: block; font-family: var(--font-fun); font-size: 19px; line-height: 1.1; }
.item-card .sets small { font-size: 11px; font-weight: 700; }
.item-card.inactive { opacity: .6; }
.item-card .stretched { position: absolute; inset: 0; z-index: 1; }

/* ═════════════ ترقيم الصفحات ═════════════ */
.pager { display: flex; align-items: center; gap: 6px; justify-content: space-between; margin-top: 16px; flex-wrap: wrap; }
.pager .info { color: var(--muted); font-size: 13.5px; }
.pager .pages { display: flex; gap: 5px; }
.pager a, .pager span.p {
  min-width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; background: #fff; color: var(--ink-2);
  border: 2px solid var(--line); font-family: var(--font-fun); padding: 0 8px; transition: all .2s var(--ease-bounce);
}
.pager a:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.pager .cur { background: var(--primary) !important; color: #fff !important; border-color: var(--primary) !important; box-shadow: 0 3px 0 #4B3DB8; }
.pager .gap { border: 0; background: transparent; }

/* ═════════════ الحالة الفاضية ═════════════ */
.empty { text-align: center; padding: 50px 20px; }
.empty svg.mascot { width: 160px; height: 160px; animation: float 3.4s ease-in-out infinite; }
.empty h3 { font-size: 21px; margin-top: 10px; }
.empty p { color: var(--muted); margin: 6px auto 18px; max-width: 420px; }

/* ═════════════ تنبيهات/توست ═════════════ */
.toasts { position: fixed; top: 18px; left: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; width: 380px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; background: #fff; border-radius: 18px; padding: 14px 16px;
  box-shadow: 0 16px 40px -12px rgba(45,52,54,.35); border-right: 6px solid var(--c, var(--mint)); animation: toast-in .5s var(--ease-bounce) both;
  font-weight: 700;
}
.toast.out { animation: toast-out .35s ease-in both; }
.toast .t-ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--c, var(--mint)); flex-shrink: 0; }
.toast.error { --c: var(--coral); }
.toast.info { --c: var(--sky); }
.toast p { margin: 6px 0 0; flex: 1; }
.toast button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; font-weight: 600; margin-bottom: 16px; }
.alert .ic { margin-top: 2px; }
.alert-warn { background: var(--sun-soft); color: #8A6100; }
.alert-error { background: var(--red-soft); color: #A61E1E; }
.alert-info { background: var(--sky-soft); color: #0B5DA0; }
.alert-ok { background: var(--mint-soft); color: #00775F; }

/* ═════════════ نوافذ منبثقة ═════════════ */
.modal-back { position: fixed; inset: 0; background: rgba(42,33,83,.45); backdrop-filter: blur(4px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade-in .2s both; }
.modal-back.out { animation: fade-out .2s both; }
.modal {
  background: #fff; border-radius: 26px; width: min(620px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  box-shadow: 0 30px 80px -20px rgba(42,33,83,.55); animation: modal-in .45s var(--ease-bounce) both;
}
.modal.wide { width: min(900px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 0; }
.modal-head h3 { font-size: 21px; }
.modal-head .x { margin-right: auto; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; gap: 10px; padding: 0 22px 22px; justify-content: flex-start; }
.modal .confirm-art { text-align: center; padding-top: 26px; }
.modal .confirm-art .bubble { width: 84px; height: 84px; border-radius: 28px; margin: 0 auto; display: grid; place-items: center; color: #fff; background: var(--c, var(--coral)); box-shadow: 0 6px 0 color-mix(in srgb, var(--c, var(--coral)) 60%, #000); animation: wobble 1.2s ease-in-out; }
.modal .confirm-art .bubble .ic { width: 42px; height: 42px; }

/* ═════════════ القائمة المنسدلة الذكية ═════════════ */
.ss { position: relative; }
.ss-control {
  display: flex; align-items: center; gap: 10px; min-height: 46px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: #fff;
  padding: 0 12px; cursor: pointer; transition: border-color .2s, box-shadow .2s;
}
.ss.open .ss-control, .ss-control:focus-within { border-color: var(--primary); box-shadow: 0 0 0 5px var(--primary-soft); }
.ss-control input { flex: 1; border: 0; outline: 0; background: transparent; min-width: 0; height: 42px; cursor: pointer; }
.ss.open .ss-control input { cursor: text; }
.ss-value { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; font-weight: 700; }
.ss-value span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-placeholder { color: var(--muted); font-weight: 500; }
.ss-clear { border: 0; background: #F1EFFA; color: var(--muted); width: 24px; height: 24px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.ss-clear:hover { background: var(--coral-soft); color: var(--coral); }
.ss-caret { color: var(--primary); transition: transform .25s var(--ease-bounce); flex-shrink: 0; }
.ss.open .ss-caret { transform: rotate(180deg); }
.ss-panel {
  position: absolute; top: calc(100% + 8px); right: 0; left: 0; z-index: 70; background: #fff; border-radius: 18px; padding: 8px;
  box-shadow: 0 22px 50px -15px rgba(42,33,83,.45); border: 1px solid var(--line); transform-origin: top center;
  animation: drop-in .25s var(--ease-bounce) both; max-height: 360px; overflow-y: auto; min-width: 300px;
}
.ss-search { position: sticky; top: -8px; background: #fff; padding: 2px 0 8px; z-index: 1; }
.ss-search input { width: 100%; height: 42px; border-radius: 12px; border: 2px solid var(--line); padding: 0 38px 0 12px; }
.ss-search input:focus { outline: 0; border-color: var(--primary); }
.ss-search .ic { position: absolute; right: 12px; top: 12px; color: var(--muted); }
.ss-opt { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 12px; cursor: pointer; transition: background .12s; }
.ss-opt:hover, .ss-opt.hl { background: var(--primary-soft); }
.ss-opt.sel { background: #E9FBF5; }
.ss-opt .o-main { flex: 1; min-width: 0; }
.ss-opt .o-main b { display: block; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-opt .o-main small { color: var(--muted); font-size: 12px; }
.ss-opt mark { background: #FFE58A; color: inherit; border-radius: 4px; padding: 0 1px; }
.ss-opt .o-side { text-align: left; font-size: 12px; color: var(--muted); white-space: nowrap; }
.ss-opt .o-side b { display: block; font-family: var(--font-fun); font-size: 14px; color: var(--ink); }
.ss-empty, .ss-loading { padding: 18px; text-align: center; color: var(--muted); }
.ss-loading .spinner { margin: 0 auto 6px; }
.ss-add { border-top: 2px dashed var(--line); margin-top: 6px; padding-top: 6px; }
.ss-add a { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 12px; font-weight: 800; }
.ss-add a:hover { background: var(--mint-soft); color: var(--mint); }

/* ═════════════ شاشة الإدخال السريع ═════════════ */
.entry { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.entry-head { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.entry-head .col-2 { grid-column: span 2; }
.picker-box { border: 3px dashed #D9D3FF; border-radius: 22px; padding: 16px; background: linear-gradient(180deg, #FCFBFF, #fff); transition: border-color .2s; }
.picker-box.has-item { border-style: solid; border-color: var(--primary); background: #fff; }
.picker-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.picker-row > .field:first-child { flex: 1 1 340px; }
.picker-row > .field { flex: 0 0 140px; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 10px; margin-top: 14px; }
.color-cell {
  border: 2px solid var(--line); border-radius: 16px; padding: 10px; background: #fff; transition: all .2s var(--ease-bounce);
  animation: pop .35s var(--ease-bounce) both; animation-delay: calc(var(--i, 0) * 25ms);
}
.color-cell.filled { border-color: var(--mint); background: #F4FFFB; box-shadow: 0 3px 0 #BDF2E2; }
.color-cell.over { border-color: var(--coral); background: #FFF6F3; }
.color-cell .ch { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 800; }
.color-cell .ch .swatch i { width: 22px; height: 22px; }
.color-cell .ch .bal { margin-right: auto; font-size: 11.5px; color: var(--muted); font-weight: 700; text-align: left; line-height: 1.3; }
.color-cell .ch .bal b { font-family: var(--font-fun); color: var(--ink-2); }
.color-cell .ins { display: grid; grid-template-columns: 1fr 76px; gap: 6px; }
.color-cell input { height: 40px; border-radius: 11px; border: 2px solid var(--line); text-align: center; font-family: var(--font-fun); font-weight: 700; font-size: 16px; min-width: 0; direction: ltr; }
.color-cell input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.color-cell input::placeholder { font-family: var(--font); font-size: 12px; font-weight: 500; color: #B5B3CC; }
.lines-list { display: flex; flex-direction: column; gap: 12px; }
.line-group { border-radius: 18px; border: 2px solid var(--line); overflow: hidden; animation: rise .4s var(--ease-bounce) both; background: #fff; }
.line-group.flash { animation: flash-ok 1s ease; }
.line-group .lg-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #FAF9FF; }
.line-group .lg-head h4 { font-size: 16.5px; }
.line-group .lg-head small { color: var(--muted); }
.line-group .lg-tot { margin-right: auto; display: flex; gap: 8px; align-items: center; }
.line-group .lg-body { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
.lg-color { display: inline-flex; align-items: center; gap: 7px; padding: 5px 6px 5px 12px; border-radius: 12px; background: #F6F5FC; font-weight: 700; font-size: 13.5px; }
.lg-color .num { color: var(--primary); }
.lg-color button { border: 0; background: transparent; color: #B2BEC3; cursor: pointer; padding: 0 2px; display: grid; place-items: center; }
.lg-color button:hover { color: var(--coral); }
.summary-card { position: sticky; top: 90px; }
.summary-card .big { font-family: var(--font-fun); font-size: 38px; font-weight: 800; line-height: 1; }
.summary-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.summary-list > div { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 13px; background: #FAF9FF; font-weight: 700; }
.summary-list .num { font-size: 18px; }
.kbd-help { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.kbd-help span { display: inline-flex; align-items: center; gap: 5px; }
.party-switch { display: flex; gap: 8px; margin-bottom: 8px; }

/* ═════════════ مراحل (الجرد/المستند) ═════════════ */
.stepper { display: flex; gap: 0; align-items: center; padding: 18px 22px; }
.step { display: flex; align-items: center; gap: 10px; flex: 1; position: relative; }
.step .bubble {
  width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-family: var(--font-fun); font-weight: 800; font-size: 18px;
  background: #EEEDF6; color: #A9A7C3; flex-shrink: 0; transition: all .3s var(--ease-bounce); z-index: 1;
}
.step b { display: block; font-size: 14.5px; }
.step small { color: var(--muted); font-size: 12px; }
.step:not(:last-child)::after { content: ""; flex: 1; height: 5px; border-radius: 3px; background: #EEEDF6; margin: 0 12px; }
.step.done .bubble { background: var(--mint); color: #fff; box-shadow: 0 4px 0 #00876C; }
.step.done:not(:last-child)::after { background: linear-gradient(90deg, var(--mint), var(--mint)); }
.step.current .bubble { background: var(--c, var(--primary)); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--c, var(--primary)) 60%, #000); animation: breathe 2s ease-in-out infinite; }
.step.current b { color: var(--c, var(--primary)); }
.step.cancelled .bubble { background: var(--red); color: #fff; }

.progress { height: 14px; border-radius: 7px; background: #EEEDF6; overflow: hidden; position: relative; }
.progress > i { position: absolute; inset: 0 0 0 auto; width: var(--w, 0%); border-radius: 7px; background: linear-gradient(90deg, var(--mint), #55EFC4); transition: width .6s var(--ease-bounce); }
.progress > i::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(-45deg, rgba(255,255,255,.25) 0 10px, transparent 10px 20px); animation: stripes 1s linear infinite; }

.count-row td { transition: background .3s; }
.count-row.st-1 { background: #F2FFFA; }
.count-row.st-2 { background: #FFF5F5; }
.count-row.st-3 { background: #F2F8FF; }
.count-row input.cnt { width: 110px; height: 40px; border-radius: 11px; border: 2px solid var(--line); text-align: center; font-family: var(--font-fun); font-weight: 700; font-size: 16px; direction: ltr; }
.count-row input.cnt-r { width: 72px; }
.count-row input.cnt:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.count-row.saving input.cnt { border-color: var(--sun); }
.count-row.saved input.cnt { border-color: var(--mint); }
.diff-pos { color: var(--sky); font-weight: 800; }
.diff-neg { color: var(--red); font-weight: 800; }
.diff-zero { color: var(--mint); font-weight: 800; }
.state-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-weight: 800; font-size: 12px; }
.state-0 { background: #F1F1F6; color: #8A8FA8; }
.state-1 { background: #E0FBF3; color: #00876C; }
.state-2 { background: #FFE5E5; color: #C0392B; }
.state-3 { background: #E3F2FF; color: #0767B1; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; }
.legend button { border: 2px solid transparent; cursor: pointer; }
.legend button.on { border-color: currentColor; transform: translateY(-2px); }

/* ═════════════ مصفوفة الألوان × المخازن ═════════════ */
.matrix th, .matrix td { text-align: center; }
.matrix td.color-col, .matrix th.color-col { text-align: right; }
.matrix .cell-qty { font-family: var(--font-fun); font-weight: 700; display: block; }
.matrix .cell-rolls { font-size: 11.5px; color: var(--muted); }
.matrix td.zero .cell-qty { color: #C9C7DB; }
.bar-mini { height: 6px; border-radius: 3px; background: #EEEDF6; margin-top: 4px; overflow: hidden; }
.bar-mini i { display: block; height: 100%; background: var(--c, var(--primary)); border-radius: 3px; width: var(--w); transition: width .8s var(--ease-bounce); }

/* ═════════════ رسوم بيانية ═════════════ */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .bar { transition: opacity .2s; transform-origin: bottom; animation: grow .8s var(--ease-bounce) both; transform-box: fill-box; }
.chart .bar:hover { opacity: .8; }
.chart .axis { stroke: #ECEAF8; stroke-width: 1; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--muted); }
.chart-legend { display: flex; gap: 14px; font-size: 13px; font-weight: 700; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; background: var(--c); margin-left: 6px; vertical-align: -1px; }
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut-wrap svg { width: 170px; height: 170px; flex-shrink: 0; }
.donut-seg { transition: stroke-width .2s; animation: donut .9s ease-out both; }
.donut-seg:hover { stroke-width: 20; }
.donut-list { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.donut-list div { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; }
.donut-list span:first-of-type { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-list .num { color: var(--ink-2); }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; }
.hbar .t { display: flex; justify-content: space-between; font-weight: 700; font-size: 13.5px; gap: 8px; }
.hbar .t span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 10px; border-radius: 5px; background: #F0EEFA; margin-top: 4px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; width: var(--w); border-radius: 5px; background: linear-gradient(90deg, var(--c, var(--primary)), color-mix(in srgb, var(--c, var(--primary)) 60%, #fff)); animation: widen 1s var(--ease-bounce) both; }

/* مراحل حالة المخزون (ألوان توضيحية) */
.levels-bar { display: flex; height: 22px; border-radius: 11px; overflow: hidden; gap: 3px; background: #F0EEFA; }
.levels-bar a { display: block; height: 100%; width: var(--w); background: var(--c); transition: filter .2s; min-width: 4px; animation: widen 1s var(--ease-bounce) both; }
.levels-bar a:hover { filter: brightness(1.12); }
.levels-legend { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.levels-legend a { display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border-radius: 14px; background: color-mix(in srgb, var(--c) 10%, #fff); color: var(--ink); transition: transform .2s var(--ease-bounce); }
.levels-legend a:hover { transform: translateY(-3px); }
.levels-legend b { font-family: var(--font-fun); font-size: 22px; color: color-mix(in srgb, var(--c) 80%, #000); line-height: 1.1; }
.levels-legend small { font-weight: 700; font-size: 12px; color: var(--ink-2); }

/* ═════════════ لوحة التحكم ═════════════ */
.hero {
  border-radius: 28px; padding: 26px 30px; color: #fff; position: relative; overflow: hidden; margin-bottom: 20px;
  background: linear-gradient(120deg, #6C5CE7 0%, #8E7CFF 45%, #FD79A8 110%); box-shadow: 0 18px 40px -18px rgba(108,92,231,.7);
  display: flex; align-items: center; gap: 24px;
}
.hero h1 { font-size: 30px; }
.hero p { margin: 6px 0 0; opacity: .9; }
.hero .mascot { width: 150px; height: 150px; flex-shrink: 0; animation: float 3.6s ease-in-out infinite; filter: drop-shadow(0 12px 18px rgba(0,0,0,.2)); }
.hero .quick { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.hero .quick .btn { --c: #fff; color: var(--primary); box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.hero .quick .btn:hover { color: var(--primary); }
.hero .spark { position: absolute; border-radius: 50%; background: rgba(255,255,255,.15); }
.hero .totals { margin-right: auto; display: flex; gap: 14px; }
.hero .tot { background: rgba(255,255,255,.16); border-radius: 18px; padding: 12px 18px; text-align: center; backdrop-filter: blur(4px); min-width: 120px; }
.hero .tot b { display: block; font-family: var(--font-fun); font-size: 28px; line-height: 1.1; }
.hero .tot small { opacity: .9; font-weight: 700; }
.mini-list { display: flex; flex-direction: column; gap: 4px; }
.mini-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 14px; transition: background .15s; color: var(--ink); }
.mini-item:hover { background: #FAF9FF; color: var(--ink); }
.mini-item .t { flex: 1; min-width: 0; }
.mini-item .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item .t small { color: var(--muted); font-size: 12px; }

/* ═════════════ الدخول ═════════════ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
  background: linear-gradient(150deg, #2A2153, #6C5CE7 60%, #FD79A8); color: #fff; padding: 50px; display: flex; flex-direction: column;
  justify-content: center; align-items: center; text-align: center; position: relative; overflow: hidden;
}
.auth-art .mascot { width: 300px; height: 300px; animation: float 4s ease-in-out infinite; filter: drop-shadow(0 22px 30px rgba(0,0,0,.25)); }
.auth-art h1 { font-size: 46px; margin-top: 10px; }
.auth-art p { opacity: .85; font-size: 17px; max-width: 420px; }
.auth-art .bubble-bg { position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); animation: float 7s ease-in-out infinite; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card { width: 100%; max-width: 430px; animation: rise .7s var(--ease-bounce) both; }
.auth-card h2 { font-size: 32px; }
.auth-card .stack { gap: 16px; }

/* ═════════════ طباعة ═════════════ */
.print-page { background: #fff; max-width: 900px; margin: 20px auto; padding: 30px; border-radius: 20px; box-shadow: var(--shadow); }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--primary); padding-bottom: 14px; margin-bottom: 16px; }
.print-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.print-meta div { background: #FAF9FF; border-radius: 10px; padding: 8px 12px; }
.print-meta small { display: block; color: var(--muted); }
.print-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 50px; text-align: center; }
.print-sign div { border-top: 2px dashed var(--muted); padding-top: 8px; font-weight: 700; color: var(--ink-2); }
.labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.label-card { border: 1.5px dashed #B2BEC3; border-radius: 10px; padding: 10px; text-align: center; page-break-inside: avoid; }
.label-card b { display: block; font-size: 14px; }
.barcode-svg { width: 100%; max-width: 240px; height: auto; }
@media print {
  body { min-width: 0; background: #fff; }
  body::before, .rail, .topbar, .no-print, .toasts { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0; }
  .print-page { box-shadow: none; margin: 0; padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  @page { margin: 12mm; }
}

/* ═════════════ أدوات ═════════════ */
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: spin .7s linear infinite; }
.skeleton { background: linear-gradient(90deg, #F0EEFA 25%, #F8F7FD 50%, #F0EEFA 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
.divider { height: 2px; background: repeating-linear-gradient(90deg, var(--line) 0 8px, transparent 8px 14px); margin: 18px 0; border: 0; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 700; }
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 10px 16px; font-weight: 800; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.on { color: var(--primary); border-color: var(--primary); }
.anim-in > * { animation: rise .55s var(--ease-bounce) both; }
.anim-in > *:nth-child(2) { animation-delay: .05s; }
.anim-in > *:nth-child(3) { animation-delay: .1s; }
.anim-in > *:nth-child(4) { animation-delay: .15s; }
.anim-in > *:nth-child(5) { animation-delay: .2s; }
.anim-in > *:nth-child(6) { animation-delay: .25s; }
.anim-in > *:nth-child(n+7) { animation-delay: .3s; }
.color-editor { display: flex; flex-direction: column; gap: 8px; }
.color-row { display: grid; grid-template-columns: 34px 46px 1fr auto auto; gap: 8px; align-items: center; animation: pop .3s var(--ease-bounce) both; }
.color-row .drag { color: #C9C7DB; cursor: grab; display: grid; place-items: center; }
.color-row input[type=color] { width: 46px; height: 42px; border: 2px solid var(--line); border-radius: 12px; padding: 3px; background: #fff; cursor: pointer; }
.color-row.off { opacity: .55; }
.palette-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.palette-quick button { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 4px 9px 4px 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12.5px; transition: transform .15s var(--ease-bounce); }
.palette-quick button:hover { transform: translateY(-2px); border-color: var(--primary); }
.palette-quick button i { width: 14px; height: 14px; border-radius: 4px; background: var(--c); border: 1px solid rgba(0,0,0,.15); }
.upload-drop { border: 3px dashed #D9D3FF; border-radius: 22px; padding: 14px; text-align: center; cursor: pointer; transition: all .2s; background: #FCFBFF; position: relative; }
.upload-drop:hover, .upload-drop.drag { border-color: var(--primary); background: var(--primary-soft); }
.upload-drop img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 16px; display: block; }
.upload-drop .ph { padding: 30px 10px; color: var(--muted); }
.upload-drop .ph .ic { width: 46px; height: 46px; color: var(--primary); }
.upload-drop input { display: none; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; }

/* ═════════════ حركات ═════════════ */
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: scale(1); } }
@keyframes bounce-in { 0% { transform: scale(.3) rotate(-20deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-12px) rotate(2deg); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-8deg); } 30% { transform: rotate(6deg); } 45% { transform: rotate(-4deg); } 60% { transform: rotate(2deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes stripes { to { background-position: 28px 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateX(-60px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(-60px) scale(.9); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(30px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-8px) scaleY(.92); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes widen { from { width: 0; } }
@keyframes donut { from { stroke-dasharray: 0 999; } }
@keyframes flash-ok { 0% { box-shadow: 0 0 0 0 rgba(0,184,148,.6); border-color: var(--mint); } 100% { box-shadow: 0 0 0 16px rgba(0,184,148,0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.validation-summary-valid { display: none !important; }
.inline { display: inline; }
.flip { transform: scaleX(-1); }
