/* Laptop Store — shared design system (storefront + dashboard). */

/* ─── Tokens ─────────────────────────────────────────────────────────── */
:root{
  --bg:#090c12;
  --surface-1:#11151c;
  --surface-2:#171c25;
  --surface-3:#1e2530;
  --surface-4:#283140;
  --line:rgba(255,255,255,.08);
  --line-strong:rgba(255,255,255,.14);
  --text:#f4f6f8;
  --text-2:#c2c8d2;
  --text-3:#8b93a1;
  --silver:#d5dae2;
  --accent:#6ea8ff;
  --accent-strong:#3d86ff;
  --accent-soft:rgba(61,134,255,.16);
  --accent-line:rgba(110,168,255,.55);
  --teal:#3ecfb2;
  --gold:#e7b15a;
  --success:#5fb38a;
  --success-soft:rgba(95,179,138,.13);
  --warn:#d4a65a;
  --warn-soft:rgba(212,166,90,.13);
  --danger:#e0716b;
  --danger-soft:rgba(224,113,107,.13);
  --wa:#2a7a55;
  --wa-hover:#318a61;
  --on-primary:#0b0c0e;
  --primary:#e9ecf1;
  --primary-hover:#ffffff;
  --scrim:rgba(4,5,6,.72);
  --shadow-sm:0 1px 2px rgba(0,0,0,.4);
  --shadow:0 12px 32px -12px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.3);
  --shadow-lg:0 28px 70px -20px rgba(0,0,0,.75), 0 4px 14px rgba(0,0,0,.35);
  --inset:inset 0 1px 0 rgba(255,255,255,.04);
  --r-sm:8px; --r:12px; --r-lg:16px; --r-xl:22px;
  --ease:cubic-bezier(.2,.7,.2,1);
  --t-fast:.14s; --t:.22s;
  --container:1240px;
  --topbar-h:64px;
  --font-ar:"IBM Plex Sans Arabic","IBM Plex Sans",system-ui,-apple-system,"Segoe UI",Tahoma,sans-serif;
  --font-en:"IBM Plex Sans","IBM Plex Sans Arabic",system-ui,-apple-system,"Segoe UI",sans-serif;
  --font-mono:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  color-scheme:dark;
}
[data-theme="light"]{
  --bg:#f4f5f7;
  --surface-1:#ffffff;
  --surface-2:#f7f8fa;
  --surface-3:#eef0f3;
  --surface-4:#e4e7ec;
  --line:rgba(15,20,30,.09);
  --line-strong:rgba(15,20,30,.17);
  --text:#111418;
  --text-2:#434a55;
  --text-3:#626a76;
  --silver:#59616d;
  --accent:#1f5fd0;
  --accent-strong:#1a56c4;
  --accent-soft:rgba(31,95,208,.12);
  --accent-line:rgba(31,95,208,.45);
  --teal:#0c7d6b;
  --gold:#9a6410;
  --success:#21794f;
  --success-soft:rgba(33,121,79,.1);
  --warn:#8f6216;
  --warn-soft:rgba(176,122,28,.12);
  --danger:#b4362f;
  --danger-soft:rgba(180,54,47,.1);
  --wa:#1f7049;
  --wa-hover:#1a603f;
  --on-primary:#ffffff;
  --primary:#15181d;
  --primary-hover:#000000;
  --scrim:rgba(20,24,30,.45);
  --shadow-sm:0 1px 2px rgba(15,20,30,.08);
  --shadow:0 12px 30px -14px rgba(15,20,30,.22), 0 2px 6px rgba(15,20,30,.06);
  --shadow-lg:0 30px 70px -24px rgba(15,20,30,.35);
  --inset:none;
  color-scheme:light;
}

/* ─── Reset ──────────────────────────────────────────────────────────── */
*,*::before,*::after{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; text-size-adjust:100%; scroll-behavior:smooth; scroll-padding-top:calc(var(--topbar-h) + 16px); }
@media (prefers-reduced-motion:reduce){
  html{ scroll-behavior:auto; }
  *,*::before,*::after{ animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; }
}
body{
  margin:0; min-height:100vh; min-height:100dvh;
  background:
    radial-gradient(880px 420px at 92% -12%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 62%),
    radial-gradient(640px 340px at -8% -6%, color-mix(in srgb, var(--teal) 18%, transparent), transparent 58%),
    var(--bg);
  color:var(--text);
  font:400 15px/1.6 var(--font-ar);
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
  text-rendering:optimizeLegibility;
}
html[lang="en"] body{ font-family:var(--font-en); line-height:1.55; }
html.has-layer body{ overflow:hidden; }
img,svg,video,iframe{ display:block; max-width:100%; }
img{ height:auto; }
button,input,select,textarea{ font:inherit; color:inherit; }
button{ cursor:pointer; background:none; border:0; padding:0; }
button:disabled{ cursor:not-allowed; }
a{ color:inherit; text-decoration:none; }
h1,h2,h3,h4,p,dl,dd,ul,ol,figure,fieldset{ margin:0; }
ul,ol{ padding:0; list-style:none; }
fieldset{ border:0; padding:0; min-width:0; }
legend{ padding:0; }
table{ border-collapse:collapse; }
hr{ border:0; border-top:1px solid var(--line); margin:6px 0; }
[hidden]{ display:none !important; }
::selection{ background:var(--accent-soft); color:var(--text); }
h1,h2,h3,h4{ font-weight:600; line-height:1.25; letter-spacing:-.005em; }
html[lang="en"] h1, html[lang="en"] h2{ letter-spacing:-.018em; }

/* ─── Focus & accessibility ──────────────────────────────────────────── */
:focus{ outline:none; }
:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; border-radius:6px; }
.btn:focus-visible,.icon-btn:focus-visible,.chip:focus-visible{ outline-offset:3px; }
.visually-hidden{ position:absolute !important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }
.skip-link{ position:fixed; inset-inline-start:16px; top:-80px; z-index:200; padding:10px 16px; border-radius:var(--r); background:var(--primary); color:var(--on-primary); font-weight:600; transition:top var(--t) var(--ease); }
.skip-link:focus{ top:12px; }

/* ─── Icons, text helpers ────────────────────────────────────────────── */
.ic{ width:18px; height:18px; flex:none; }
[data-icon]{ display:inline-flex; }
.mono{ font-family:var(--font-mono); font-weight:500; letter-spacing:.01em; font-feature-settings:"zero" 0; }
.muted{ color:var(--text-3); }
.center{ text-align:center; }
.eyebrow{ font-size:12px; font-weight:600; color:var(--text-3); letter-spacing:.02em; }
html[lang="en"] .eyebrow{ text-transform:uppercase; letter-spacing:.12em; font-size:11px; }
.container{ width:100%; max-width:var(--container); margin-inline:auto; padding-inline:20px; }
@media (min-width:768px){ .container{ padding-inline:28px; } }
.scroll-x{ display:flex; overflow-x:auto; overscroll-behavior-x:contain; scrollbar-width:none; -webkit-overflow-scrolling:touch; }
.scroll-x::-webkit-scrollbar{ display:none; }
.num{ font-variant-numeric:tabular-nums; }

/* ─── Buttons ────────────────────────────────────────────────────────── */
.btn{
  --h:44px;
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:var(--h); padding:0 18px; border-radius:var(--r);
  font-size:14px; font-weight:600; line-height:1.2; white-space:nowrap;
  border:1px solid transparent; user-select:none;
  transition:background var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.btn:active:not(:disabled){ transform:translateY(1px); }
.btn:disabled,.btn[aria-disabled="true"]{ opacity:.5; }
.btn .ic{ width:18px; height:18px; }
.btn-sm{ --h:36px; padding:0 13px; font-size:13px; border-radius:10px; gap:6px; }
.btn-sm .ic{ width:16px; height:16px; }
.btn-lg{ --h:52px; padding:0 22px; font-size:15px; border-radius:14px; }
.btn-block{ width:100%; }
.btn-primary{ background:var(--primary); color:var(--on-primary); box-shadow:var(--shadow-sm); }
.btn-primary:hover:not(:disabled){ background:var(--primary-hover); }
.btn-secondary{ background:var(--surface-3); color:var(--text); border-color:var(--line-strong); box-shadow:var(--inset); }
.btn-secondary:hover:not(:disabled){ background:var(--surface-4); }
.btn-ghost{ color:var(--text-2); }
.btn-ghost:hover:not(:disabled){ background:var(--surface-3); color:var(--text); }
.btn-ghost[aria-pressed="true"]{ color:var(--accent); background:var(--accent-soft); }
.btn-accent{ background:var(--accent-strong); color:#0b0e15; }
.btn-accent:hover:not(:disabled){ background:var(--accent); }
[data-theme="light"] .btn-accent{ color:#fff; }
.btn-danger{ background:var(--danger-soft); color:var(--danger); border-color:color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover:not(:disabled){ background:color-mix(in srgb, var(--danger) 22%, transparent); }
.btn-wa{ background:var(--wa); color:#fff; }
.btn-wa:hover:not(:disabled){ background:var(--wa-hover); }
.btn-wa:disabled{ background:var(--surface-3); color:var(--text-3); opacity:1; border-color:var(--line); }
.link-btn{ display:inline-flex; align-items:center; gap:4px; color:var(--accent); font-weight:600; font-size:13px; padding:4px 2px; border-radius:6px; }
.link-btn .ic{ width:15px; height:15px; }
[dir="rtl"] .link-btn .ic{ transform:scaleX(-1); }
.link-btn:hover{ text-decoration:underline; text-underline-offset:3px; }
.btn.is-busy{ position:relative; color:transparent !important; pointer-events:none; }
.btn.is-busy::after{ content:""; position:absolute; width:16px; height:16px; border-radius:50%; border:2px solid currentColor; border-color:var(--text-3) var(--text-3) transparent transparent; animation:spin .7s linear infinite; }
.btn-primary.is-busy::after{ border-color:var(--on-primary) var(--on-primary) transparent transparent; }

.icon-btn{
  position:relative; display:inline-grid; place-items:center; flex:none;
  width:40px; height:40px; border-radius:var(--r); color:var(--text-2);
  transition:background var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) ease;
}
.icon-btn:hover:not(:disabled){ background:var(--surface-3); color:var(--text); }
.icon-btn:active:not(:disabled){ transform:scale(.96); }
.icon-btn:disabled{ opacity:.4; }
.icon-btn.on,.icon-btn[aria-pressed="true"]{ color:var(--accent); }
.icon-btn-glass{ width:36px; height:36px; border-radius:11px; color:#f3f4f6; background:rgba(10,11,13,.55); -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px); border:1px solid rgba(255,255,255,.1); }
.icon-btn-glass:hover:not(:disabled){ background:rgba(10,11,13,.75); color:#fff; }
.icon-btn-glass.on{ color:#f0a5a0; }
.icon-btn-glass .ic{ width:17px; height:17px; }
.count{ display:inline-grid; place-items:center; min-width:18px; height:18px; padding:0 5px; border-radius:9px; background:var(--accent-strong); color:#0b0e15; font:600 11px/1 var(--font-en); }
[data-theme="light"] .count{ color:#fff; }
.has-count .count{ position:absolute; top:2px; inset-inline-end:2px; }

/* Segmented control */
.segmented{ display:inline-flex; padding:3px; gap:2px; border-radius:11px; background:var(--surface-2); border:1px solid var(--line); }
.segmented > button{ display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:32px; min-width:34px; padding:0 10px; border-radius:8px; color:var(--text-3); font-size:13px; font-weight:600; transition:background var(--t-fast), color var(--t-fast); }
.segmented > button:hover{ color:var(--text); }
.segmented > button[aria-pressed="true"],.segmented > button[aria-selected="true"]{ background:var(--surface-4); color:var(--text); box-shadow:var(--shadow-sm); }
.segmented .ic{ width:16px; height:16px; }
.segmented-block{ display:flex; width:100%; }
.segmented-block > button{ flex:1; min-height:38px; }

/* ─── Chips, pills, badges ───────────────────────────────────────────── */
.chips{ display:flex; flex-wrap:wrap; gap:8px; }
.chips.scroll-x{ flex-wrap:nowrap; }
.chip{
  display:inline-flex; align-items:center; gap:7px; flex:none;
  min-height:34px; padding:0 13px; border-radius:999px;
  border:1px solid var(--line-strong); background:transparent; color:var(--text-2);
  font-size:13px; font-weight:500; white-space:nowrap;
  transition:border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
}
.chip:hover{ color:var(--text); border-color:var(--text-3); }
.chip.on{ background:var(--accent-soft); border-color:var(--accent-line); color:var(--text); }
.chip-n{ font:500 11px/1 var(--font-en); color:var(--text-3); font-variant-numeric:tabular-nums; }
.chip.on .chip-n{ color:var(--accent); }
.pill{ display:inline-flex; align-items:center; gap:6px; min-height:30px; padding:0 8px 0 12px; border-radius:999px; background:var(--surface-3); border:1px solid var(--line); font-size:12.5px; color:var(--text); }
[dir="rtl"] .pill{ padding:0 12px 0 8px; }
.pill .ic{ width:14px; height:14px; color:var(--text-3); }
.pill:hover .ic{ color:var(--danger); }

.badges{ display:flex; flex-wrap:wrap; gap:6px; }
.badge{ display:inline-flex; align-items:center; gap:5px; height:24px; padding:0 9px; border-radius:7px; font-size:11.5px; font-weight:600; white-space:nowrap; border:1px solid transparent; line-height:1; }
.badge .ic{ width:13px; height:13px; }
.badge-neutral{ background:var(--surface-3); color:var(--text-2); border-color:var(--line); }
.badge-accent{ background:var(--accent-soft); color:var(--accent); border-color:color-mix(in srgb, var(--accent) 25%, transparent); }
.badge-success{ background:var(--success-soft); color:var(--success); border-color:color-mix(in srgb, var(--success) 25%, transparent); }
.badge-warn{ background:var(--warn-soft); color:var(--warn); border-color:color-mix(in srgb, var(--warn) 25%, transparent); }
.badge-danger{ background:var(--danger-soft); color:var(--danger); border-color:color-mix(in srgb, var(--danger) 25%, transparent); }

/* ─── Forms ──────────────────────────────────────────────────────────── */
.field{ display:grid; gap:6px; min-width:0; }
.field > label,.field-label{ font-size:13px; font-weight:600; color:var(--text-2); }
.field .req{ color:var(--danger); margin-inline-start:2px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),select,textarea,.select{
  width:100%; min-height:44px; padding:10px 13px;
  background:var(--surface-2); border:1px solid var(--line-strong); border-radius:10px;
  color:var(--text); font-size:15px; line-height:1.4;
  transition:border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
textarea{ min-height:96px; resize:vertical; }
input::placeholder,textarea::placeholder{ color:var(--text-3); opacity:1; }
input:hover:not(:disabled):not(:focus),select:hover:not(:disabled):not(:focus),textarea:hover:not(:disabled):not(:focus){ border-color:color-mix(in srgb, var(--text-3) 70%, transparent); }
input:focus,select:focus,textarea:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
input:disabled,select:disabled,textarea:disabled{ opacity:.55; cursor:not-allowed; }
input[aria-invalid="true"],select[aria-invalid="true"],textarea[aria-invalid="true"]{ border-color:var(--danger); box-shadow:0 0 0 3px var(--danger-soft); }
input[type="number"]{ -moz-appearance:textfield; }
input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{ -webkit-appearance:none; margin:0; }
input[type="search"]::-webkit-search-cancel-button{ -webkit-appearance:none; }
select,.select{
  appearance:none; -webkit-appearance:none; cursor:pointer;
  padding-inline-end:38px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23878e99' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-size:16px; background-position:right 12px center;
}
[dir="rtl"] select,[dir="rtl"] .select{ background-position:left 12px center; }
select option{ background:var(--surface-2); color:var(--text); }
input[type="checkbox"],input[type="radio"]{ accent-color:var(--accent-strong); width:18px; height:18px; margin:0; flex:none; }
.hint{ font-size:12.5px; color:var(--text-3); }
.field-error,.form-error{ display:flex; gap:6px; align-items:flex-start; font-size:13px; color:var(--danger); font-weight:500; }
.form-error{ padding:10px 12px; border-radius:10px; background:var(--danger-soft); }
.form-stack{ display:grid; gap:16px; }
.inline-form{ display:flex; gap:8px; }
.inline-form input{ flex:1; }
.input-affix{ position:relative; }
.input-affix input{ padding-inline-end:46px !important; }
.affix-btn{ position:absolute; inset-inline-end:4px; top:50%; transform:translateY(-50%); width:38px; height:36px; display:grid; place-items:center; border-radius:8px; color:var(--text-3); }
.affix-btn:hover{ color:var(--text); background:var(--surface-3); }
.check{ display:flex; align-items:flex-start; gap:10px; font-size:14px; cursor:pointer; }
.check small{ display:block; color:var(--text-3); font-size:12.5px; }

/* Switch */
.switch{ display:flex; align-items:center; justify-content:space-between; gap:14px; cursor:pointer; }
.switch input{ position:absolute; opacity:0; pointer-events:none; }
.switch .track{ position:relative; width:40px; height:24px; flex:none; border-radius:12px; background:var(--surface-4); border:1px solid var(--line-strong); transition:background var(--t-fast); }
.switch .track::after{ content:""; position:absolute; top:3px; inset-inline-start:3px; width:16px; height:16px; border-radius:50%; background:var(--text-2); transition:transform var(--t) var(--ease), background var(--t-fast); }
.switch input:checked + .track{ background:var(--accent-strong); border-color:transparent; }
.switch input:checked + .track::after{ background:#fff; transform:translateX(16px); }
[dir="rtl"] .switch input:checked + .track::after{ transform:translateX(-16px); }
.switch input:focus-visible + .track{ outline:2px solid var(--accent); outline-offset:2px; }
.switch input:disabled + .track{ opacity:.5; }

/* ─── Notices & states ───────────────────────────────────────────────── */
.notice{ display:flex; align-items:center; gap:10px; padding:11px 14px; border-radius:var(--r); background:var(--surface-2); border:1px solid var(--line); color:var(--text-2); font-size:13.5px; }
.notice > .ic{ color:var(--accent); }
.notice > span{ flex:1; }
.notice-warn{ background:var(--warn-soft); border-color:color-mix(in srgb, var(--warn) 30%, transparent); color:var(--text); }
.notice-warn > .ic{ color:var(--warn); }
.notice-danger{ background:var(--danger-soft); border-color:color-mix(in srgb, var(--danger) 30%, transparent); color:var(--text); }
.notice-danger > .ic{ color:var(--danger); }
.notice-success{ background:var(--success-soft); border-color:color-mix(in srgb, var(--success) 30%, transparent); color:var(--text); }
.notice-success > .ic{ color:var(--success); }

.state{ grid-column:1 / -1; display:grid; justify-items:center; gap:10px; padding:56px 20px; text-align:center; border:1px dashed var(--line-strong); border-radius:var(--r-lg); background:var(--surface-1); }
.state-ic{ display:grid; place-items:center; width:52px; height:52px; border-radius:16px; background:var(--surface-3); color:var(--text-2); margin-bottom:4px; }
.state-ic .ic{ width:24px; height:24px; }
.state h3{ font-size:18px; }
.state p{ color:var(--text-3); max-width:46ch; font-size:14px; }
.state-actions{ display:flex; flex-wrap:wrap; justify-content:center; gap:10px; margin-top:8px; }
.state-error{ border-style:solid; border-color:color-mix(in srgb, var(--danger) 30%, transparent); }
.state-error .state-ic{ background:var(--danger-soft); color:var(--danger); }

/* Skeletons */
.skeleton{ pointer-events:none; }
.sk-media,.sk-line,.sk-block{ background:linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size:200% 100%; animation:shimmer 1.4s ease-in-out infinite; border-radius:8px; }
.sk-media{ aspect-ratio:4 / 3; border-radius:0; }
.sk-line{ height:12px; margin:14px 16px 0; }
.sk-line:last-child{ margin-bottom:18px; }
.w40{ width:40%; } .w60{ width:60%; } .w80{ width:80%; }
@keyframes shimmer{ from{ background-position:100% 0; } to{ background-position:-100% 0; } }
@keyframes spin{ to{ transform:rotate(360deg); } }
@keyframes fade-in{ from{ opacity:0; } to{ opacity:1; } }
@keyframes rise{ from{ opacity:0; transform:translateY(10px) scale(.985); } to{ opacity:1; transform:none; } }
@keyframes slide-up{ from{ transform:translateY(100%); } to{ transform:none; } }
@keyframes slide-in-end{ from{ transform:translateX(100%); } to{ transform:none; } }
@keyframes slide-in-start{ from{ transform:translateX(-100%); } to{ transform:none; } }

/* ─── Layers: modal, drawer, lightbox ────────────────────────────────── */
.layer{ position:fixed; inset:0; z-index:100; display:flex; background:var(--scrim); -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px); animation:fade-in var(--t) ease; overscroll-behavior:contain; }
.layer-center{ align-items:center; justify-content:center; padding:24px; }
.modal{
  position:relative; width:100%; max-width:1120px; max-height:calc(100dvh - 48px);
  display:flex; flex-direction:column; overflow:hidden;
  background:var(--surface-1); border:1px solid var(--line-strong); border-radius:var(--r-xl); box-shadow:var(--shadow-lg);
  animation:rise .28s var(--ease);
}
.modal-sm{ max-width:520px; }
.modal-md{ max-width:760px; }
.modal-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 16px 14px 22px; border-bottom:1px solid var(--line); flex:none; }
[dir="rtl"] .modal-head{ padding:14px 22px 14px 16px; }
.modal-head h2{ font-size:18px; }
.modal-body{ padding:22px; overflow:auto; flex:1; }
.modal-foot{ display:flex; justify-content:flex-end; gap:10px; padding:14px 22px; border-top:1px solid var(--line); background:var(--surface-2); flex:none; flex-wrap:wrap; }
@media (max-width:719px){
  .layer-center{ padding:0; align-items:flex-end; }
  .modal{ max-height:94dvh; border-radius:var(--r-xl) var(--r-xl) 0 0; border-bottom:0; animation:slide-up .3s var(--ease); }
  .modal-body{ padding:18px; padding-bottom:max(18px, env(safe-area-inset-bottom)); }
}
.layer-side{ justify-content:flex-end; }
.drawer{
  width:min(440px, 100%); height:100%; display:flex; flex-direction:column; overflow:hidden;
  background:var(--surface-1); border-inline-start:1px solid var(--line-strong); box-shadow:var(--shadow-lg);
  animation:slide-in-end .3s var(--ease);
}
[dir="rtl"] .drawer{ animation-name:slide-in-start; }
.drawer-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:20px 16px 16px 22px; border-bottom:1px solid var(--line); }
[dir="rtl"] .drawer-head{ padding:20px 22px 16px 16px; }
.drawer-head h2{ font-size:19px; }
.drawer-head p{ font-size:13px; margin-top:2px; word-break:break-all; }
.drawer-body{ flex:1; overflow:auto; padding:20px 22px max(24px, env(safe-area-inset-bottom)); display:grid; align-content:start; gap:20px; }
.drawer-section{ display:grid; gap:12px; padding-top:18px; border-top:1px solid var(--line); }
.drawer-section h3{ font-size:14px; }

/* ─── Floating menus ─────────────────────────────────────────────────── */
.menu-back{ position:fixed; inset:0; z-index:140; }
.menu-pop{
  position:fixed; z-index:141; min-width:240px; max-width:min(340px, calc(100vw - 20px)); max-height:calc(100dvh - 20px); overflow:auto;
  padding:6px; background:var(--surface-3); border:1px solid var(--line-strong); border-radius:14px; box-shadow:var(--shadow-lg);
  animation:rise .16s var(--ease);
}
.menu-pop > a,.menu-pop > button{ display:flex; align-items:center; gap:10px; width:100%; min-height:40px; padding:0 12px; border-radius:9px; font-size:14px; color:var(--text); text-align:start; }
.menu-pop > a:hover,.menu-pop > button:hover,.menu-pop > a:focus-visible,.menu-pop > button:focus-visible{ background:var(--surface-4); outline:none; }
.menu-pop > a .ic,.menu-pop > button .ic{ color:var(--text-3); }
.menu-pop .danger{ color:var(--danger); }
.menu-pop .danger .ic{ color:var(--danger); }
.menu-title{ display:flex; align-items:center; gap:8px; padding:8px 12px 10px; font-size:12px; color:var(--text-3); font-weight:600; border-bottom:1px solid var(--line); margin-bottom:4px; }
.menu-title .ic{ width:15px; height:15px; }
.menu-seg{ display:flex; gap:4px; padding:4px; margin:2px 0 4px; background:var(--surface-2); border-radius:10px; }
.menu-seg > button{ flex:1; min-height:32px; border-radius:7px; font-size:13px; font-weight:600; color:var(--text-3); }
.menu-seg > button[aria-pressed="true"]{ background:var(--surface-4); color:var(--text); }
.menu-thumbs{ display:grid; grid-template-columns:repeat(4, 1fr); gap:6px; padding:6px; }
.menu-thumbs button{ border-radius:8px; overflow:hidden; border:1px solid var(--line); aspect-ratio:4 / 3; }
.menu-thumbs img{ width:100%; height:100%; object-fit:cover; }
.menu-thumbs button:hover{ border-color:var(--accent); }

/* ─── Toast ──────────────────────────────────────────────────────────── */
.toast{
  position:fixed; z-index:180; bottom:max(20px, env(safe-area-inset-bottom)); left:50%;
  display:flex; align-items:center; gap:10px; max-width:min(520px, calc(100vw - 32px));
  padding:12px 16px; border-radius:14px; background:var(--surface-4); color:var(--text);
  border:1px solid var(--line-strong); box-shadow:var(--shadow-lg); font-size:14px; font-weight:500;
  opacity:0; pointer-events:none; transform:translate(-50%, 16px); transition:opacity var(--t) ease, transform var(--t) var(--ease);
}
.toast.on{ opacity:1; transform:translate(-50%, 0); pointer-events:auto; }
.toast-ic{ display:inline-flex; color:var(--success); }
.toast[data-kind="warn"] .toast-ic{ color:var(--warn); }
.toast[data-kind="error"]{ border-color:color-mix(in srgb, var(--danger) 45%, transparent); }
.toast[data-kind="error"] .toast-ic{ color:var(--danger); }
.toast-ic:empty{ display:none; }

/* ─── Shared bits ────────────────────────────────────────────────────── */
.brand{ display:flex; align-items:center; gap:11px; flex:none; border-radius:10px; }
.brand-mark{ display:grid; place-items:center; width:36px; height:36px; border-radius:11px; background:linear-gradient(145deg, var(--accent), #2456c9); border:1px solid transparent; color:#fff; box-shadow:0 8px 18px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.brand-mark .ic{ width:19px; height:19px; }
.brand-text{ display:grid; line-height:1.15; }
.brand-text b{ font-size:15px; font-weight:600; }
.brand-text small{ font-size:11.5px; color:var(--text-3); }
.spin{ display:inline-block; width:16px; height:16px; flex:none; border-radius:50%; border:2px solid var(--text-3); border-right-color:transparent; animation:spin .7s linear infinite; }
.card-surface{ background:var(--surface-1); border:1px solid var(--line); border-radius:var(--r-lg); box-shadow:var(--inset); }
.lang-code{ font:600 13px/1 var(--font-en); letter-spacing:.04em; }
html[lang="en"] .lang-code{ font-family:var(--font-ar); font-size:15px; }
.img-fail{ object-fit:contain !important; background:var(--surface-2); }
.lib-fail{ display:grid; place-items:center; min-height:70vh; padding:24px; text-align:center; }
.lib-fail > div{ display:grid; gap:12px; justify-items:center; max-width:420px; }

/* ─── Print (shared) ─────────────────────────────────────────────────── */
.print-sheet{ display:none; }
@media print{
  @page{ size:A4; margin:14mm; }
  html,body{ background:#fff !important; color:#111 !important; }
  html.printing body > *:not(.print-sheet){ display:none !important; }
  html.printing .print-sheet{ display:block !important; }
}
