/* ==========================================================================
   النخب الأول — Admin stylesheet
   ========================================================================== */
:root {
  --gold: #e5a51c;
  --gold-2: #ffd36a;
  --gold-3: #a9660a;
  --gold-soft: #fdf0cf;
  --amber: #f6a91b;
  --bg: #f6efe3;
  --bg-2: #fbf5ea;
  --surface: #fffdf9;
  --surface-2: #fbf3e5;
  --surface-3: #f4e7cf;
  --ink: #2a1a0c;
  --ink-2: #4b3420;
  --muted: #82694d;
  --line: rgba(72, 47, 20, 0.13);
  --line-strong: rgba(72, 47, 20, 0.24);
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --success: #1e7d4f;
  --success-soft: #e7f6ee;
  --warn: #9a6a00;
  --warn-soft: #fff5d6;
  --info: #2563a8;
  --info-soft: #e8f1fd;
  --sidebar: #29190a;
  --sidebar-2: #382311;
  --shadow-sm: 0 4px 14px -8px rgba(70, 44, 12, 0.22);
  --shadow: 0 24px 60px -30px rgba(70, 44, 12, 0.35);
  --shadow-lg: 0 40px 90px -40px rgba(70, 44, 12, 0.45);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --ease: cubic-bezier(0.22, 0.8, 0.28, 1);
  --sans: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "El Messiri", "Tajawal", system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #120c06;
  --bg-2: #1a1108;
  --surface: #1d1309;
  --surface-2: #261a0d;
  --surface-3: #322111;
  --ink: #f8ecda;
  --ink-2: #e6d3b6;
  --muted: #b39a7c;
  --line: rgba(248, 236, 218, 0.12);
  --line-strong: rgba(248, 236, 218, 0.24);
  --gold-soft: #38250c;
  --danger-soft: #3a1713;
  --success-soft: #12301f;
  --warn-soft: #362a0b;
  --info-soft: #12243a;
  --sidebar: #0d0803;
  --sidebar-2: #1d1309;
  --shadow-sm: 0 4px 14px -8px rgba(0, 0, 0, 0.6);
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.75);
  --shadow-lg: 0 40px 90px -40px rgba(0, 0, 0, 0.85);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--gold); color: #1e1206; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1.15em; height: 1.15em; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}
#i-whatsapp path { fill: currentColor; stroke: none; }

/* ---------- Buttons / badges ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: 0.95rem;
  border: 1px solid transparent; transition: transform 0.15s var(--ease), box-shadow 0.2s, background 0.2s;
  white-space: nowrap; line-height: 1.3;
}
.btn:active { transform: translateY(1px); }
.btn--gold {
  background: linear-gradient(135deg, var(--gold), #f1b73a);
  color: #2a1a0c; box-shadow: 0 10px 24px -12px rgba(229, 165, 28, 0.75);
}
.btn--gold:hover { box-shadow: 0 14px 28px -12px rgba(229, 165, 28, 0.9); }
.btn--ghost { border-color: var(--line-strong); background: var(--surface); color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { filter: brightness(1.05); }
.btn--soft-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn--sm { padding: 7px 13px; font-size: 0.875rem; border-radius: 10px; }
.btn--block { width: 100%; }
.btn--icon { padding: 8px; width: 36px; height: 36px; border-radius: 9px; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn--gold .icon { stroke-width: 2.1; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 11px; display: inline-flex;
  align-items: center; justify-content: center; color: var(--ink-2);
  border: 1px solid var(--line); background: var(--surface); transition: 0.2s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.icon-btn .icon { width: 1.2em; height: 1.2em; }
.icon-btn:disabled { opacity: 0.35; pointer-events: none; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border-radius: 999px; background: var(--gold-soft); color: var(--gold-3);
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.01em;
}
[data-theme="dark"] .pill { color: var(--gold-2); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; font-size: 0.75rem; font-weight: 700; white-space: nowrap;
}
.badge--gold { background: var(--gold-soft); color: var(--gold-3); }
.badge--green { background: var(--success-soft); color: var(--success); }
.badge--red { background: var(--danger-soft); color: var(--danger); }
.badge--blue { background: var(--info-soft); color: var(--info); }
.badge--gray { background: var(--surface-3); color: var(--muted); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
[data-theme="dark"] .badge--gold { color: var(--gold-2); }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 0.95fr;
  background: var(--bg);
}
.login__art {
  position: relative; overflow: hidden; display: flex; align-items: center;
  padding: 48px; color: #fff8ea;
  background:
    radial-gradient(1000px 500px at 20% 10%, rgba(246, 169, 27, 0.32), transparent 60%),
    radial-gradient(800px 500px at 90% 90%, rgba(229, 165, 28, 0.18), transparent 60%),
    linear-gradient(160deg, #1e1207, #3a230d 55%, #1c1106);
}
.login__art::before {
  content: ""; position: absolute; inset: 0; opacity: 0.18;
  background-image: radial-gradient(circle at 1px 1px, #ffd36a 1.4px, transparent 0);
  background-size: 26px 26px;
}
.login__art-inner { position: relative; z-index: 1; max-width: 560px; }
.login__logo { display: flex; align-items: center; gap: 16px; margin-bottom: 54px; }
.login__logo img {
  width: 66px; height: 66px; border-radius: 20px; padding: 6px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 211, 106, 0.3);
}
.login__logo strong { display: block; font-family: var(--display); font-size: 1.5rem; }
.login__logo span { font-size: 0.9rem; color: rgba(255, 248, 234, 0.65); }
.login__art h1 {
  font-family: var(--display); font-size: clamp(2.2rem, 3.6vw, 3.4rem);
  line-height: 1.2; font-weight: 700; letter-spacing: -0.01em;
}
.login__art h1 em {
  font-style: normal;
  background: linear-gradient(100deg, var(--gold-2), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login__art p { margin-top: 18px; color: rgba(255, 248, 234, 0.72); font-size: 1.02rem; max-width: 470px; }
.login__features { margin-top: 34px; display: grid; gap: 12px; }
.login__features li { display: flex; align-items: center; gap: 11px; color: rgba(255, 248, 234, 0.88); font-weight: 500; }
.login__features .icon { color: var(--gold-2); width: 1.25em; height: 1.25em; }
.login__bees {
  position: absolute; inset-inline-end: 38px; bottom: 28px; font-size: 46px; opacity: 0.5;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.4)); transform: rotate(-12deg);
}
.login__panel { display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.login__form { width: min(100%, 430px); }
.login__form h2 { font-family: var(--display); font-size: 2rem; margin-top: 16px; }
.login__sub { color: var(--muted); margin: 6px 0 28px; }
.login__hint {
  margin-top: 20px; padding: 11px 14px; border-radius: 12px; font-size: 0.84rem;
  background: var(--warn-soft); color: var(--warn); border: 1px dashed rgba(154, 106, 0, 0.35);
}
.login__back { margin-top: 24px; text-align: center; font-size: 0.9rem; }
.login__back a { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.login__back a:hover { color: var(--gold-3); }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span:first-child, .field > label:first-child {
  display: block; font-size: 0.86rem; font-weight: 700; color: var(--ink-2); margin-bottom: 7px;
}
.field__box {
  display: flex; align-items: center; gap: 9px; padding: 0 13px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field__box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(229, 165, 28, 0.16); }
.field__box .icon { color: var(--muted); }
.field__box input { flex: 1; border: 0; background: none; outline: none; padding: 12px 0; min-width: 0; }
.field__eye { padding: 4px; color: var(--muted); display: inline-flex; }
.field__eye:hover { color: var(--ink); }

input[type="text"], input[type="password"], input[type="tel"], input[type="url"],
input[type="number"], input[type="datetime-local"], input[type="date"], input[type="search"],
select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: var(--surface); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--gold); box-shadow: 0 0 0 3px rgba(229, 165, 28, 0.16);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
select { cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.7; }
input[type="checkbox"] { accent-color: var(--gold); width: 17px; height: 17px; }
input[type="file"] { padding: 9px; font-size: 0.88rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.form-grid .span-2 { grid-column: span 2; }
.form-error {
  background: var(--danger-soft); color: var(--danger); padding: 10px 14px;
  border-radius: 10px; font-size: 0.88rem; margin: 0 0 16px;
}
.form-hint { font-size: 0.8rem; color: var(--muted); margin-top: 5px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.checkbox-row input { margin: 0; }

/* ---------- App layout ---------- */
.app { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background:
    radial-gradient(500px 260px at 80% 0%, rgba(229, 165, 28, 0.16), transparent 70%),
    linear-gradient(180deg, var(--sidebar), #1b1007);
  color: #f6e9d6; padding: 20px 16px 16px; z-index: 40;
}
.sidebar__brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 18px; border-bottom: 1px solid rgba(255, 211, 106, 0.14); }
.sidebar__mark {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(255, 211, 106, 0.1); border: 1px solid rgba(255, 211, 106, 0.25);
}
.sidebar__brand strong { display: block; font-family: var(--display); font-size: 1.12rem; line-height: 1.25; }
.sidebar__brand small { color: rgba(246, 233, 214, 0.55); font-size: 0.76rem; }
.sidebar__close { display: none; margin-inline-start: auto; background: transparent; border-color: rgba(255,255,255,.15); color: #fff; }
.sidebar__nav { flex: 1; overflow-y: auto; padding-top: 16px; display: grid; gap: 4px; align-content: start; }
.sidebar__section { font-size: 0.7rem; letter-spacing: 0.08em; color: rgba(246, 233, 214, 0.38); font-weight: 700; padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px;
  color: rgba(246, 233, 214, 0.72); font-weight: 600; font-size: 0.93rem;
  transition: background 0.2s, color 0.2s; width: 100%; text-align: start;
}
.nav-item .icon { width: 1.25em; height: 1.25em; color: rgba(255, 211, 106, 0.65); }
.nav-item:hover { background: rgba(255, 211, 106, 0.08); color: #fff; }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(229, 165, 28, 0.22), rgba(229, 165, 28, 0.08));
  color: #ffe9bd; box-shadow: inset 2px 0 0 var(--gold-2);
}
.nav-item.is-active .icon { color: var(--gold-2); }
.nav-item__count {
  margin-inline-start: auto; background: var(--gold); color: #2a1a0c;
  font-size: 0.72rem; font-weight: 800; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
}
.sidebar__foot { border-top: 1px solid rgba(255, 211, 106, 0.14); padding-top: 12px; display: grid; gap: 3px; }
.sidebar__link {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: rgba(246, 233, 214, 0.66); font-size: 0.9rem; font-weight: 600; text-align: start; width: 100%;
}
.sidebar__link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar__user { display: flex; align-items: center; gap: 10px; padding: 14px 8px 2px; }
.avatar {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), #f2b63a); color: #2a1a0c;
  font-family: var(--display); font-weight: 700; font-size: 1.05rem;
}
.sidebar__user b { display: block; font-size: 0.9rem; }
.sidebar__user small { color: rgba(246, 233, 214, 0.45); font-size: 0.75rem; }

.app__main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 14px 28px; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.topbar__menu { display: none; }
.topbar__title { flex: 1; min-width: 0; }
.topbar__crumb { font-size: 0.76rem; color: var(--muted); font-weight: 600; }
.topbar h1 { font-family: var(--display); font-size: 1.42rem; line-height: 1.3; font-weight: 700; }
.topbar__actions { display: flex; align-items: center; gap: 9px; }
.save-state {
  display: inline-flex; align-items: center; gap: 7px; font-size: 0.8rem; color: var(--success);
  background: var(--success-soft); padding: 5px 11px; border-radius: 999px; font-weight: 700;
}
.save-state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.content { padding: 26px 28px 48px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card__head { display: flex; align-items: center; gap: 12px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.card__head h2, .card__head h3 { font-family: var(--display); font-size: 1.08rem; font-weight: 700; }
.card__head p { font-size: 0.8rem; color: var(--muted); }
.card__head .spacer { flex: 1; }
.card__body { padding: 20px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-start; }

.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head__text { flex: 1; min-width: 220px; }
.page-head__text h2 { font-family: var(--display); font-size: 1.5rem; }
.page-head__text p { color: var(--muted); font-size: 0.9rem; margin-top: 3px; }
.page-head__actions { display: flex; gap: 9px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  position: relative; overflow: hidden; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.stat::after {
  content: ""; position: absolute; inset-inline-end: -30px; top: -30px; width: 110px; height: 110px;
  border-radius: 50%; background: var(--gold-soft); opacity: 0.55;
}
.stat__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; z-index: 1; }
.stat__label { color: var(--muted); font-size: 0.84rem; font-weight: 600; }
.stat__icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--gold-3);
}
[data-theme="dark"] .stat__icon { color: var(--gold-2); }
.stat__value { font-family: var(--display); font-size: 1.75rem; font-weight: 700; margin-top: 8px; position: relative; z-index: 1; }
.stat__meta { font-size: 0.78rem; color: var(--muted); margin-top: 2px; position: relative; z-index: 1; }
.stat--gold { background: linear-gradient(145deg, #2c1b0a, #4a2e0e); border-color: transparent; color: #fff4dd; }
.stat--gold .stat__label, .stat--gold .stat__meta { color: rgba(255, 244, 221, 0.62); }
.stat--gold .stat__icon { background: rgba(255, 211, 106, 0.14); color: var(--gold-2); }
.stat--gold::after { background: rgba(255, 211, 106, 0.12); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dash-side { display: grid; gap: 18px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th {
  text-align: start; font-size: 0.76rem; font-weight: 800; color: var(--muted);
  padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background 0.15s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .strong { font-weight: 700; }
table.data .muted { color: var(--muted); font-size: 0.82rem; }
.cell-product { display: flex; align-items: center; gap: 11px; min-width: 220px; }
.cell-product img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.cell-product b { display: block; font-size: 0.9rem; }
.cell-product small { color: var(--muted); font-size: 0.78rem; display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 5px; justify-content: flex-end; }
.row-actions .icon-btn { width: 33px; height: 33px; border-radius: 8px; }
.row-actions .icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.cell-actions { text-align: end; }
.status-select { padding: 6px 9px; font-size: 0.8rem; border-radius: 8px; width: auto; }

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}
.toolbar__search {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px;
  border: 1px solid var(--line-strong); background: var(--bg-2); border-radius: 10px; padding: 0 11px;
}
.toolbar__search input { border: 0; background: none; box-shadow: none; padding: 9px 0; }
.toolbar__search input:focus { box-shadow: none; }
.toolbar select { width: auto; min-width: 150px; padding: 9px 12px; }
.toolbar__count { font-size: 0.8rem; color: var(--muted); margin-inline-start: auto; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 0.83rem; font-weight: 700; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; transition: 0.2s;
}
.chip:hover { border-color: var(--gold); color: var(--gold-3); }
.chip.is-active { background: var(--gold-soft); border-color: transparent; color: var(--gold-3); }
[data-theme="dark"] .chip.is-active { color: var(--gold-2); }
.chip b { font-size: 0.72rem; background: rgba(0, 0, 0, 0.06); padding: 0 6px; border-radius: 999px; }
[data-theme="dark"] .chip b { background: rgba(255, 255, 255, 0.08); }

.empty {
  padding: 46px 20px; text-align: center; color: var(--muted);
}
.empty .icon { width: 2.6em; height: 2.6em; margin-bottom: 12px; opacity: 0.45; }
.empty h3 { color: var(--ink-2); font-family: var(--display); margin-bottom: 4px; }
.empty p { font-size: 0.88rem; }

/* ---------- Orders ---------- */
.order-number { font-weight: 800; color: var(--gold-3); white-space: nowrap; }
[data-theme="dark"] .order-number { color: var(--gold-2); }
.customer-cell b { display: block; font-size: 0.88rem; }
.customer-cell small { color: var(--muted); font-size: 0.78rem; direction: ltr; display: inline-block; }
.order-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.detail-block { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; }
.detail-block h4 { font-size: 0.78rem; color: var(--muted); margin-bottom: 7px; font-weight: 800; letter-spacing: 0.02em; }
.detail-block p { font-size: 0.9rem; margin-bottom: 2px; }
.detail-block a { color: var(--info); }
.items-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.items-table th { text-align: start; padding: 8px 10px; color: var(--muted); font-size: 0.75rem; border-bottom: 1px solid var(--line); }
.items-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.items-table tfoot td { font-weight: 800; border-bottom: 0; }
.order-total { font-family: var(--display); font-size: 1.3rem; color: var(--gold-3); }
[data-theme="dark"] .order-total { color: var(--gold-2); }

/* ---------- Products / images ---------- */
.img-field { display: flex; gap: 14px; align-items: flex-start; }
.img-preview {
  width: 112px; height: 112px; border-radius: 12px; overflow: hidden; flex-shrink: 0;
  border: 1px dashed var(--line-strong); background: var(--surface-2);
  display: grid; place-items: center; color: var(--muted);
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-field__body { flex: 1; min-width: 0; display: grid; gap: 8px; }
.upload-row { display: flex; gap: 8px; flex-wrap: wrap; }
.upload-row input[type="file"] { display: none; }

.repeater { display: grid; gap: 8px; }
.repeater__row { display: grid; grid-template-columns: minmax(0, 1.4fr) 110px 110px 36px; gap: 8px; align-items: center; }
.repeater__row input { padding: 9px 11px; font-size: 0.88rem; }
.repeater__head { display: grid; grid-template-columns: minmax(0, 1.4fr) 110px 110px 36px; gap: 8px; font-size: 0.72rem; color: var(--muted); font-weight: 700; padding: 0 2px; }
.repeater__del { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--danger); background: var(--danger-soft); }
.repeater__del:hover { filter: brightness(0.97); }
.feature-row { display: flex; gap: 8px; align-items: center; }
.feature-row input { flex: 1; }

.product-thumb-toggle { opacity: 1; }
.switch { position: relative; display: inline-flex; width: 40px; height: 23px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3);
  border: 1px solid var(--line-strong); transition: 0.2s;
}
.switch i::after {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); transition: 0.2s;
}
.switch input:checked + i { background: var(--gold); border-color: transparent; }
.switch input:checked + i::after { transform: translateX(-17px); }
[dir="rtl"] .switch input:checked + i::after { transform: translateX(-17px); }

/* ---------- Offer / gallery ---------- */
.offer-preview {
  display: grid; grid-template-columns: 130px 1fr; gap: 16px; align-items: center;
  padding: 14px; border-radius: 14px; background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
}
.offer-preview img { width: 130px; height: 150px; object-fit: cover; border-radius: 11px; }
.offer-preview h3 { font-family: var(--display); font-size: 1.15rem; }
.offer-preview p { font-size: 0.84rem; color: var(--muted); margin-top: 4px; }
.offer-preview .price { font-family: var(--display); font-size: 1.35rem; color: var(--gold-3); margin-top: 6px; }
[data-theme="dark"] .offer-preview .price { color: var(--gold-2); }
.offer-preview .price s { font-size: 0.85rem; color: var(--muted); margin-inline-start: 7px; }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 13px; }
.gallery-item {
  position: relative; border-radius: 13px; overflow: hidden; border: 1px solid var(--line);
  aspect-ratio: 4 / 5; background: var(--surface-2);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-item__cap {
  position: absolute; inset-inline: 0; bottom: 0; padding: 22px 10px 8px;
  background: linear-gradient(transparent, rgba(20, 12, 3, 0.86)); color: #fff;
  font-size: 0.8rem; font-weight: 600; line-height: 1.45;
}
.gallery-item__tools { position: absolute; top: 8px; inset-inline-end: 8px; display: flex; gap: 5px; opacity: 0; transition: 0.2s; }
.gallery-item:hover .gallery-item__tools { opacity: 1; }
.gallery-item__tools button {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(20, 12, 3, 0.7); color: #fff; backdrop-filter: blur(4px);
}
.gallery-item__tools button:hover { background: var(--danger); }
.gallery-item__tools .up:hover { background: var(--gold); color: #2a1a0c; }

/* ---------- Settings / account ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.settings-grid .span-2 { grid-column: span 2; }
.section-title { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-size: 1.02rem; margin-bottom: 14px; }
.section-title .icon { color: var(--gold-3); }
[data-theme="dark"] .section-title .icon { color: var(--gold-2); }

.note {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: 11px; background: var(--info-soft);
  color: var(--info); font-size: 0.85rem; line-height: 1.6;
}
.note .icon { flex-shrink: 0; margin-top: 2px; }
.note--warn { background: var(--warn-soft); color: var(--warn); }
.note--danger { background: var(--danger-soft); color: var(--danger); }

.backup-list { display: grid; gap: 8px; }
.backup-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 13px;
  background: var(--surface-2); border-radius: 10px; font-size: 0.85rem;
}
.backup-row b { font-weight: 700; }
.backup-row small { color: var(--muted); margin-inline-start: auto; }
.backup-row .icon { color: var(--muted); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 24px; }
.modal.is-open { display: flex; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(18, 11, 4, 0.55); backdrop-filter: blur(4px); }
.modal__card {
  position: relative; width: min(100%, 720px); max-height: calc(100vh - 48px);
  overflow-y: auto; background: var(--surface); border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 26px; animation: modalIn 0.24s var(--ease);
}
.modal__card--wide { width: min(100%, 900px); }
.modal__card--narrow { width: min(100%, 460px); }
.modal__close { position: absolute; top: 16px; inset-inline-end: 16px; z-index: 2; }
.modal__head { margin-bottom: 18px; padding-inline-end: 44px; }
.modal__head h2 { font-family: var(--display); font-size: 1.35rem; }
.modal__head p { color: var(--muted); font-size: 0.86rem; margin-top: 2px; }
.modal__actions { display: flex; gap: 9px; justify-content: flex-start; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal__actions .spacer { flex: 1; }
.modal__body { display: grid; gap: 0; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }

.confirm-box { text-align: center; padding: 8px 4px 2px; }
.confirm-box__icon {
  width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center;
  margin: 0 auto 14px; background: var(--danger-soft); color: var(--danger);
}
.confirm-box h2 { font-family: var(--display); font-size: 1.25rem; margin-bottom: 6px; }
.confirm-box p { color: var(--muted); font-size: 0.9rem; }
.confirm-box .modal__actions { justify-content: center; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; inset-block-end: 20px; inset-inline-start: 20px; z-index: 200; display: grid; gap: 9px; max-width: min(360px, calc(100vw - 40px)); }
.toast {
  display: flex; align-items: center; gap: 9px; padding: 12px 15px; border-radius: 12px;
  background: var(--sidebar); color: #fff4dd; box-shadow: var(--shadow);
  font-size: 0.88rem; font-weight: 600; animation: toastIn 0.28s var(--ease);
}
.toast .icon { color: var(--gold-2); flex-shrink: 0; }
.toast--success .icon { color: #6ee7a8; }
.toast--error .icon { color: #ff9f95; }
.toast.is-out { animation: toastOut 0.25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Misc ---------- */
.skeleton { padding: 40px; text-align: center; color: var(--muted); }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-14 { margin-top: 14px; } .mt-20 { margin-top: 20px; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(10, 6, 2, 0.5); z-index: 35; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .span-2 { grid-column: auto; }
}
@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; }
  .login__art { display: none; }
  .login__panel { min-height: 100vh; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px;
    transform: translateX(100%); transition: transform 0.28s var(--ease); box-shadow: var(--shadow-lg);
  }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar__close { display: inline-flex; }
  .sidebar-overlay.is-open { display: block; }
  .topbar__menu { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 20px 16px 40px; }
}
@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat__value { font-size: 1.45rem; }
  .topbar__actions .btn span { display: none; }
  .topbar h1 { font-size: 1.18rem; }
  .form-grid, .form-grid--3, .grid-2 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .repeater__row, .repeater__head { grid-template-columns: 1fr 80px 80px 34px; }
  .modal { padding: 10px; }
  .modal__card { padding: 20px 16px; border-radius: 16px; max-height: calc(100vh - 20px); }
  .order-detail-grid { grid-template-columns: 1fr; }
  .cell-product { min-width: 180px; }
  #quickAddBtn { display: none; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn { flex: 1; }
}
@media (max-width: 460px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .login__panel { padding: 28px 18px; }
  .row-actions { flex-direction: column; align-items: flex-end; }
}
