/* Galeria — studio & platform admin */
:root {
  --bg: #f6f6f4;
  --panel: #ffffff;
  --side: #fbfbfa;
  --fg: #18181b;
  --fg-2: #52525b;
  --muted: #8a8a93;
  --line: #e7e7e4;
  --line-2: #efefec;
  --hover: #f1f1ee;
  --danger: #d03a32;
  --ok: #1f8a4c;
  --warn: #b7791f;
  --radius: 10px;
  --font: 'Inter', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --shadow-sm: 0 1px 2px rgba(16, 16, 20, 0.05);
  --shadow: 0 8px 30px -12px rgba(16, 16, 20, 0.18);
  --side-w: 248px;
  color-scheme: light;
}
html[lang='ar'] { --font: 'IBM Plex Sans Arabic', 'Inter', 'Segoe UI', Tahoma, sans-serif; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; }
.hide-sm { }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
bdi { unicode-bidi: isolate; }
.icon-btn-spacer { width: 32px; height: 32px; }

/* ------------------------------------------------------------------ app shell */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  width: var(--side-w); flex: none;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px;
  background: var(--side);
  border-inline-end: 1px solid var(--line);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; min-width: 0; }
.sidebar-logo { max-height: 30px; max-width: 120px; object-fit: contain; }
.sidebar-mark {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none;
  border-radius: 8px; background: var(--fg); color: #fff; font-weight: 600;
}
.sidebar-name { font-weight: 600; font-size: 14.5px; line-height: 1.2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; flex-direction: column; }
.sidebar-name small { font-weight: 400; color: var(--muted); font-size: 12px; }
.sidebar-logo + .sidebar-name { display: none; }
.sidebar-logo { max-height: 34px; max-width: 170px; }
.sidebar-cta { margin: 2px 0 12px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px;
  color: var(--fg-2); text-decoration: none; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover { background: var(--hover); color: var(--fg); }
.sidebar-nav a.is-active { background: #ececea; color: var(--fg); }
.sidebar-nav .icon { color: var(--muted); }
.sidebar-nav a.is-active .icon { color: var(--fg); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.quota { padding: 0 6px; }
.quota-label { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px 6px 0; border-top: 1px solid var(--line); }
.sidebar-user-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 13px; }
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: 50%; background: rgba(var(--accent-rgb), 0.14); color: var(--accent);
  font-weight: 600; font-size: 12px;
}
.avatar-lg { width: 40px; height: 40px; font-size: 15px; }
.lang-switch { display: flex; gap: 2px; padding: 2px; background: var(--hover); border-radius: 8px; }
.lang-switch button { flex: 1; border: 0; background: none; padding: 4px 6px; border-radius: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.lang-switch button.is-active { background: var(--panel); color: var(--fg); box-shadow: var(--shadow-sm); }
.main { flex: 1; min-width: 0; }
.topbar { display: none; }
.impersonation-bar {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 7px 16px; background: #fff7e6; color: #7a4d00; border-bottom: 1px solid #f3dfb5; font-size: 13px;
}
.impersonation-bar form { display: inline; }
.link-btn { border: 0; background: none; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; color: inherit; font-weight: 600; }
.sidebar-scrim { display: none; }

/* ------------------------------------------------------------------ page */
.page { padding: 32px clamp(18px, 3vw, 44px) 80px; max-width: 1360px; }
.page-narrow { max-width: 860px; }
.page-wide { max-width: 1600px; }
.page-narrow-inner { max-width: 820px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; }
.page-sub { margin: 4px 0 0; color: var(--muted); }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 6px; }
.back-link:hover { color: var(--fg); }
html[dir='rtl'] .back-link .icon, html[dir='rtl'] .sidebar-nav .icon-chev { transform: scaleX(-1); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-title { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.card > .card-title { padding: 18px 20px 0; }
.card > .table, .card > p, .card > .timeline { margin: 0 20px 18px; }
.card > .table { margin: 0; width: 100%; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid transparent; border-radius: 8px;
  font-weight: 500; font-size: 13.5px; white-space: nowrap;
  text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, filter 0.15s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, var(--shadow-sm); }
.btn-primary:hover { filter: brightness(0.93); }
.btn-secondary { background: var(--panel); border-color: var(--line); color: var(--fg); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--hover); }
.btn-ghost { background: transparent; color: var(--fg-2); }
.btn-ghost:hover { background: var(--hover); color: var(--fg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.93); }
.btn-danger-outline { background: var(--panel); border-color: #f0c9c6; color: var(--danger); }
.btn-danger-outline:hover { background: #fdf2f1; }
.btn-danger-text { color: var(--danger); }
.btn-whatsapp { background: #1fa855; color: #fff; }
.btn-whatsapp:hover { filter: brightness(0.94); }
.btn-block { width: 100%; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.is-copied { border-color: var(--ok); color: var(--ok); }
.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); cursor: pointer; text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.icon-btn-sm { width: 26px; height: 26px; }
.icon-btn-sm .icon { width: 15px; height: 15px; }

/* ------------------------------------------------------------------ forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-sections { gap: 16px; }
.form-section { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding: 24px; }
.form-section-head h2 { margin: 0 0 4px; font-size: 14.5px; font-weight: 600; }
.form-section-head p { margin: 0; color: var(--muted); font-size: 13px; }
.form-section-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.field > span, .field-label { font-size: 13px; font-weight: 500; color: var(--fg); }
.field em { font-style: normal; color: var(--muted); font-weight: 400; }
.field small, .hint { color: var(--muted); font-size: 12.5px; }
.hint { display: flex; align-items: center; gap: 6px; margin: 0; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row > .field { min-width: 180px; }
input[type='text'], input[type='email'], input[type='password'], input[type='date'], input[type='number'], input[type='search'], input:not([type]), select, textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--fg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { height: auto; padding: 9px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15); }
input[readonly] { background: var(--bg); }
input[type='file'] { font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-2); cursor: pointer; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }
.sticky-actions { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); z-index: 5; }
.alert { padding: 12px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid; }
.alert-error { background: #fdf3f2; border-color: #f4d1ce; color: #8f241e; }
.alert-warn { background: #fff8eb; border-color: #f4e0b5; color: #7a4d00; }
.alert-ok { background: #f1faf4; border-color: #cfe9d8; color: #14532d; }
.credentials { display: flex; flex-direction: column; gap: 10px; }
.credentials p { margin: 0; }

/* switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line-2); cursor: pointer; }
.switch-row span { display: flex; flex-direction: column; }
.switch-row strong { font-weight: 500; }
.switch-row small { color: var(--muted); font-size: 12.5px; }
.switch {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 38px; height: 22px; border-radius: 999px; margin: 0;
  background: #d9d9d5; position: relative; cursor: pointer; transition: background 0.2s;
  box-shadow: none !important; border: 0 !important; padding: 0 !important;
}
.switch::after {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.2s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
html[dir='rtl'] .switch:checked::after { transform: translateX(-16px); }

/* choice cards */
.choice-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice-cards-2 { grid-template-columns: repeat(2, 1fr); }
.choice-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--panel); transition: border-color 0.15s, box-shadow 0.15s; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15); }
.choice-card:has(input:focus-visible) { outline: 2px solid var(--accent); }
.choice-label { font-size: 12.5px; font-weight: 500; text-align: center; }
.layout-diagram { position: relative; display: block; height: 70px; border-radius: 6px; overflow: hidden; background: linear-gradient(135deg, #b9a58a, #6f5d48); }
.layout-diagram b { position: absolute; display: block; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.9); }
.layout-center b:nth-of-type(1) { width: 46%; left: 27%; top: 30px; height: 6px; }
.layout-center b:nth-of-type(2) { width: 24%; left: 38%; top: 42px; }
.layout-left b:nth-of-type(1) { width: 46%; left: 10%; top: 44px; height: 6px; }
.layout-left b:nth-of-type(2) { width: 24%; left: 10%; top: 56px; }
.layout-split { background: linear-gradient(90deg, #f4f2ee 42%, transparent 42%), linear-gradient(135deg, #b9a58a, #6f5d48); }
.layout-split b { background: #3f3a33; }
.layout-split b:nth-of-type(1) { width: 26%; left: 8%; top: 30px; height: 6px; }
.layout-split b:nth-of-type(2) { width: 16%; left: 8%; top: 42px; }
.theme-swatch { display: flex; height: 44px; border-radius: 6px; overflow: hidden; gap: 4px; padding: 8px; }
.theme-light { background: #faf9f7; border: 1px solid var(--line); }
.theme-dark { background: #121211; }
.theme-swatch i { flex: 1; border-radius: 3px; background: #d8d2c8; }
.theme-dark i { background: #3a3733; }
.font-choices { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.font-choice { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.font-choice input { position: absolute; opacity: 0; }
.font-choice:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15); }
.font-sample { font-size: 28px; line-height: 1.1; }
.font-name { font-size: 11px; color: var(--muted); text-align: center; }
.font-cormorant .font-sample { font-family: 'Cormorant Garamond', serif; }
.font-playfair .font-sample { font-family: 'Playfair Display', serif; }
.font-lora .font-sample { font-family: 'Lora', serif; }
.font-jost .font-sample { font-family: 'Jost', sans-serif; font-weight: 300; }
.font-montserrat .font-sample { font-family: 'Montserrat', sans-serif; font-weight: 300; }
.color-field { display: flex; gap: 8px; }
.color-field input[type='color'] { width: 44px; height: 38px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; flex: none; }
.logo-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.logo-slot { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.logo-slot > .field-label { min-height: 2.9em; display: flex; align-items: flex-end; }
.logo-drop { display: block; cursor: pointer; border-radius: 10px; }
.logo-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.logo-preview {
  height: 112px; display: grid; place-items: center; padding: 14px;
  border-radius: 10px; border: 1.5px dashed #d6d6d1; background: var(--bg);
  transition: border-color 0.15s, background 0.15s; overflow: hidden;
}
.logo-drop:hover .logo-preview, .logo-drop.is-over .logo-preview { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.05); }
.logo-slot-dark .logo-preview { background: #151514; border-color: #2a2a28; color: #9a9a94; }
.logo-slot-dark .logo-drop:hover .logo-preview, .logo-slot-dark .logo-drop.is-over .logo-preview { border-color: var(--accent); background: #1c1c1a; }
.logo-preview img { max-height: 64px; max-width: 100%; object-fit: contain; }
.logo-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 12px; color: var(--muted); }
.logo-slot-dark .logo-empty { color: #9a9a94; }
.logo-empty .icon { width: 20px; height: 20px; }
.logo-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.logo-status { margin: 0; min-height: 1em; font-size: 12px; color: var(--muted); }
.logo-slot.is-removing .logo-preview img { opacity: 0.25; }

/* segmented */
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: #ececea; border-radius: 9px; }
.segmented button, .segmented label span { display: inline-flex; align-items: center; padding: 5px 12px; border: 0; border-radius: 7px; background: none; color: var(--fg-2); font-size: 13px; font-weight: 500; cursor: pointer; }
.segmented button.is-active, .segmented label input:checked + span { background: var(--panel); color: var(--fg); box-shadow: var(--shadow-sm); }
.segmented label input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-lg { align-self: flex-start; }
.segmented-lg label span { padding: 7px 16px; }

/* ------------------------------------------------------------------ auth */
.auth-body { min-height: 100vh; background: radial-gradient(900px 500px at 50% -10%, rgba(var(--accent-rgb), 0.1), transparent 70%), var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 16px; gap: 22px; }
.auth-logo { max-height: 52px; max-width: 220px; object-fit: contain; }
.auth-wordmark { font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
.auth-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 30px; box-shadow: var(--shadow); }
.auth-title { margin: 0 0 4px; font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.auth-sub { margin: 0 0 20px; color: var(--muted); }
.auth-card .form { margin-top: 18px; }
.auth-lang { width: 200px; }
.checklist { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.checklist li { display: inline-flex; align-items: center; gap: 4px; }
.checklist .ok .icon { color: var(--ok); width: 14px; height: 14px; }
.checklist .missing { color: var(--danger); }
.checklist .missing .icon { width: 14px; height: 14px; }

/* ------------------------------------------------------------------ dashboard */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.6fr); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-sm); }
.stat-label { color: var(--muted); font-size: 12.5px; }
.stat-value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.stat-wide .meter { margin-top: 6px; }
.meter { height: 6px; border-radius: 999px; background: #ebebe8; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 0.3s ease; }
.meter-sm { height: 4px; }
.meter-warn span { background: var(--warn); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.search { position: relative; flex: 1; max-width: 360px; min-width: 200px; }
.search .icon { position: absolute; top: 10px; inset-inline-start: 11px; color: var(--muted); width: 17px; height: 17px; }
.search input { padding-inline-start: 36px; }
.gallery-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.gcard { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; box-shadow: var(--shadow-sm); transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s; }
.gcard:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #dcdcd8; }
.gcard-cover { position: relative; aspect-ratio: 3 / 2; background: #ecebe8; overflow: hidden; }
.gcard-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s ease; }
.gcard:hover .gcard-cover img { transform: scale(1.03); }
.gcard-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #b5b5ae; }
.gcard-placeholder .icon { width: 32px; height: 32px; }
.gcard-cover .pill { position: absolute; top: 10px; inset-inline-start: 10px; }
.gcard-lock { position: absolute; top: 10px; inset-inline-end: 10px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,0.92); color: var(--fg-2); }
.gcard-lock .icon { width: 14px; height: 14px; }
.gcard-body { padding: 14px 16px 14px; display: flex; flex-direction: column; gap: 2px; }
.gcard-title { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard-meta { margin: 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); color: var(--fg-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.gcard-stats span { display: inline-flex; align-items: center; gap: 5px; }
.gcard-stats .icon { width: 14px; height: 14px; color: var(--muted); }
.gcard-exp { margin-inline-start: auto; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: #efefec; color: var(--fg-2); white-space: nowrap; }
.pill-published { background: #e7f6ec; color: #166534; }
.pill-draft { background: #f1f1ee; color: #57534e; }
.pill-expired { background: #fdecea; color: #9b2c22; }
.gcard-cover .pill { background: rgba(255,255,255,0.94); box-shadow: var(--shadow-sm); }
.gcard-cover .pill-published { color: #166534; }
.gcard-cover .pill-expired { color: #9b2c22; }
.empty { text-align: center; padding: 64px 20px; background: var(--panel); border: 1px dashed var(--line); border-radius: 14px; }
.empty-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: rgba(var(--accent-rgb), 0.1); color: var(--accent); margin-bottom: 8px; }
.empty-icon .icon { width: 24px; height: 24px; }
.empty h2, .empty h3 { margin: 8px 0 4px; font-size: 17px; font-weight: 600; }
.empty p { margin: 0 auto 18px; color: var(--muted); max-width: 380px; }

/* ------------------------------------------------------------------ tables */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: start; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfbfa; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.table-hover tbody tr { cursor: pointer; }
.table-hover tbody tr:hover td { background: #fafaf8; }
.table-card { overflow-x: auto; }
.strong-link { font-weight: 600; text-decoration: none; }
.usage-cell { min-width: 170px; }
.usage-cell span { font-size: 12.5px; color: var(--fg-2); display: block; margin-bottom: 4px; }

/* ------------------------------------------------------------------ gallery editor */
.gallery-head { align-items: flex-end; }
.gallery-head-main { min-width: 0; }
.gallery-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta-icon { display: inline-flex; align-items: center; gap: 4px; }
.meta-icon .icon { width: 14px; height: 14px; }
.status-toggle { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 500; font-size: 13px; box-shadow: var(--shadow-sm); }
.status-toggle .dot { width: 8px; height: 8px; border-radius: 50%; background: #a8a8a1; }
.status-toggle.is-on { border-color: #bfe3cb; background: #f0faf3; color: #166534; }
.status-toggle.is-on .dot { background: #22a35a; box-shadow: 0 0 0 3px rgba(34,163,90,0.18); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px 12px; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; }
.tab .icon { width: 16px; height: 16px; }
.tab em { font-style: normal; font-size: 11.5px; padding: 0 6px; border-radius: 999px; background: #ececea; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.tab:hover { color: var(--fg); }
.tab.is-active { color: var(--fg); }
.tab.is-active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--fg); }
.editor > * { min-width: 0; }
.editor { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; align-items: start; }
.sets-panel { position: sticky; top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow-sm); }
.sets-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
html[lang='ar'] .sets-head { letter-spacing: 0; }
.sets-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.set-item { position: relative; display: flex; align-items: center; border-radius: 7px; flex-wrap: wrap; }
.set-item:hover { background: var(--hover); }
.set-item.is-active { background: #ececea; }
.set-grip { display: grid; place-items: center; width: 14px; color: #c4c4be; cursor: grab; margin-inline-start: 2px; }
.set-grip .icon { width: 14px; height: 14px; }
.set-select { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 0; background: none; cursor: pointer; text-align: start; font-weight: 500; color: var(--fg-2); }
.set-item.is-active .set-select { color: var(--fg); }
.set-select .icon { width: 16px; height: 16px; color: var(--muted); }
.set-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-select em { font-style: normal; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.set-actions { display: none; padding-inline-end: 4px; }
.set-item:hover .set-actions { display: flex; }
.set-item:hover .set-select em { display: none; }
.set-input { height: 32px !important; margin: 2px 4px; }
.set-confirm { width: 100%; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; background: #fff7f6; border-radius: 6px; margin: 4px; }
.set-confirm p { margin: 0 0 4px; width: 100%; font-size: 12.5px; }
.sets-hint { margin: 10px 8px 4px; font-size: 12px; color: var(--muted); }
.editor-main { min-width: 0; }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; min-height: 38px; }
.editor-toolbar-left, .editor-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.editor-count, #selection-count { color: var(--muted); font-size: 13px; }
.upload-btn { position: relative; overflow: hidden; }
.upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 4px); inset-inline-end: 0; z-index: 20; min-width: 200px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.menu button { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 0; background: none; border-radius: 6px; text-align: start; cursor: pointer; }
.menu button:hover { background: var(--hover); }
.inline-confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 12px; border-radius: 8px; background: #fdf3f2; border: 1px solid #f4d1ce; color: #8f241e; font-size: 13.5px; }
.inline-confirm > span { flex: 1; min-width: 200px; }
.inline-confirm input { max-width: 220px; }
.dropzone { position: relative; min-height: 360px; border-radius: 12px; }
.dropzone-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 360px; border: 1.5px dashed #d6d6d1; border-radius: 12px; background: var(--panel); padding: 30px; }
.dropzone-empty h3 { margin: 10px 0 4px; font-size: 16px; }
.dropzone-empty p { margin: 0; color: var(--muted); max-width: 400px; }
.drop-overlay { position: absolute; inset: 0; display: none; place-items: center; border: 2px dashed var(--accent); border-radius: 12px; background: rgba(var(--accent-rgb), 0.08); color: var(--accent); font-weight: 600; z-index: 10; }
.drop-overlay div { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.drop-overlay .icon { width: 30px; height: 30px; }
.dropzone.is-over .drop-overlay { display: grid; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ptile { position: relative; margin: 0; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #ecebe8; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: manipulation; outline-offset: 2px; transition: box-shadow 0.15s; }
.ptile img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; -webkit-user-drag: none; }
.ptile-noimg { position: absolute; inset: 0; display: grid; place-items: center; color: #a7a7a0; }
.ptile-check { position: absolute; top: 8px; inset-inline-start: 8px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.95); background: rgba(0,0,0,0.18); color: transparent; opacity: 0; transition: opacity 0.15s; }
.ptile-check .icon { width: 14px; height: 14px; }
.ptile:hover .ptile-check, .ptile.is-selected .ptile-check { opacity: 1; }
.ptile.is-selected { box-shadow: 0 0 0 3px var(--accent); }
.ptile.is-selected .ptile-check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ptile.is-selected img { transform: scale(0.94); border-radius: 4px; transition: transform 0.15s; }
.ptile-badge { position: absolute; top: 8px; inset-inline-end: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 999px; background: rgba(255,255,255,0.94); font-size: 11px; font-weight: 600; }
.ptile-badge .icon { width: 13px; height: 13px; }
.ptile-video { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(0,0,0,0.45); color: #fff; }
.ptile-video .icon { width: 16px; height: 16px; margin-inline-start: 2px; }
.ptile figcaption { position: absolute; inset: auto 0 0 0; padding: 18px 8px 6px; background: linear-gradient(to top, rgba(0,0,0,0.6), transparent); color: #fff; font-size: 11.5px; display: flex; justify-content: space-between; gap: 6px; opacity: 0; transition: opacity 0.15s; }
.ptile figcaption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptile figcaption em { font-style: normal; opacity: 0.8; flex: none; }
.ptile:hover figcaption { opacity: 1; }
.sort-ghost { position: fixed !important; z-index: 1000; pointer-events: none; opacity: 0.92; box-shadow: 0 20px 40px -10px rgba(0,0,0,0.4); border-radius: 8px; transform-origin: 0 0; list-style: none; background: var(--panel); }
.sort-placeholder { opacity: 0.25; }
body.is-sorting, body.is-sorting * { cursor: grabbing !important; user-select: none; }

/* upload panel */
.upload-panel { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 40; width: min(380px, calc(100vw - 24px)); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 60px -20px rgba(16,16,20,0.35); overflow: hidden; }
.upload-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 10px 16px; }
.upload-panel-head strong { font-size: 13.5px; font-weight: 600; }
.upload-panel > .meter { border-radius: 0; height: 3px; }
.upload-panel.is-collapsed .upload-list { display: none; }
.upload-panel.is-collapsed [data-action='toggle-uploads'] .icon { transform: rotate(180deg); }
.upload-list { list-style: none; margin: 0; padding: 4px 0; max-height: 46vh; overflow-y: auto; }
.up-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 16px; }
.up-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: #f1f1ee; color: var(--muted); flex: none; }
.up-icon .icon { width: 15px; height: 15px; }
.up-done .up-icon { background: #e7f6ec; color: var(--ok); }
.up-error .up-icon { background: #fdecea; color: var(--danger); }
.up-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.up-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-error .up-meta { color: var(--danger); white-space: normal; }
.up-actions { display: flex; gap: 2px; }
.up-footer { display: flex; justify-content: flex-end; gap: 6px; padding: 6px 12px 8px; border-top: 1px solid var(--line-2); }

/* share / favourites / activity */
.share-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.share-card { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.share-card h2 { margin: 6px 0 0; font-size: 13px; font-weight: 600; color: var(--fg-2); }
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.message-preview { margin: 0; white-space: pre-wrap; font: 13.5px/1.6 var(--font); background: #f5f9f5; border: 1px solid #dfeee1; border-radius: 10px; padding: 14px; }
.fav-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.fav-client { padding: 18px; margin-bottom: 14px; }
.fav-client-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fav-client-id { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fav-client-id a { color: var(--muted); font-size: 13px; text-decoration: none; }
.fav-client-meta { display: flex; align-items: center; gap: 10px; }
.fav-count { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fav-count .icon { width: 15px; height: 15px; color: var(--accent); }
.fav-note { margin: 14px 0 0; padding: 10px 14px; border-inline-start: 3px solid var(--accent); background: #fafaf8; border-radius: 0 8px 8px 0; color: var(--fg-2); }
.fav-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 14px; }
.fav-strip figure { position: relative; margin: 0; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: #ecebe8; }
.fav-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fav-strip figcaption { display: none; }
.fav-filenames { margin-top: 12px; font-size: 13px; color: var(--muted); }
.fav-filenames summary { cursor: pointer; }
.fav-filenames code { display: block; margin-top: 8px; padding: 10px 12px; background: #fafaf8; border: 1px solid var(--line); border-radius: 8px; color: var(--fg); word-break: break-word; font-size: 12.5px; }
.activity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.activity-grid .card { padding-bottom: 6px; overflow: hidden; }
.timeline { list-style: none; padding: 0; margin: 0 20px 14px; }
.timeline li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.timeline li:last-child { border-bottom: 0; }
.timeline-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #f1f1ee; color: var(--muted); flex: none; }
.timeline-icon .icon { width: 13px; height: 13px; }
.timeline-text { flex: 1; min-width: 0; }
.timeline time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 24px; margin-top: 24px; border-color: #f4d1ce; }
.danger-zone h2 { margin: 0 0 2px; font-size: 14.5px; }
.danger-zone p { margin: 0; color: var(--muted); font-size: 13px; }
.danger-zone .inline-confirm { width: 100%; margin: 0; }
.domain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.domain-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.domain-list li .mono { flex: 1; }
.domain-list form { display: inline; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 200px; }

/* toasts */
.toast { display: flex; align-items: center; gap: 10px; margin: 16px clamp(18px, 3vw, 44px) 0; padding: 10px 14px; border-radius: 9px; font-size: 13.5px; max-width: 640px; transition: opacity 0.3s, transform 0.3s; }
.toast-ok { background: #f0faf3; border: 1px solid #cfe9d8; color: #14532d; }
.toast-error { background: #fdf3f2; border: 1px solid #f4d1ce; color: #8f241e; }
.toast.is-out { opacity: 0; transform: translateY(-6px); }
.toast-host { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast-float { margin: 0; background: #18181b; color: #fafafa; border: 0; box-shadow: var(--shadow); border-radius: 999px; padding: 10px 16px; }
.toast-float.toast-error .icon { color: #ff8a80; }
.toast-float .icon { color: #86efac; width: 16px; height: 16px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-wide { grid-column: 1 / -1; }
  .form-section { grid-template-columns: 1fr; gap: 14px; }
  .share-grid, .activity-grid { grid-template-columns: 1fr; }
  .font-choices { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 80; inset-block: 0; inset-inline-start: 0; height: 100%;
    transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: var(--shadow);
  }
  html[dir='rtl'] .sidebar { transform: translateX(100%); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,0.3); }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: 0; z-index: 30; padding: 8px 10px; background: rgba(246,246,244,0.92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .topbar-name { font-weight: 600; }
  .page { padding: 20px 14px 80px; }
  .page-title { font-size: 22px; }
  .editor { grid-template-columns: minmax(0, 1fr); }
  .main { overflow-x: clip; }
  .sets-panel { position: static; }
  .sets-list { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .set-item { flex: 0 1 auto; max-width: 100%; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); padding-inline-end: 2px; }
  .set-item.is-active { background: #ececea; border-color: #dcdcd8; }
  .set-item .set-grip { display: none; }
  .set-select { padding: 6px 10px; }
  .set-actions { display: flex; }
  .set-item:hover .set-select em { display: inline; }
  .set-item.set-new { flex-basis: 100%; border-radius: 10px; }
  .set-confirm { flex-basis: 100%; margin: 4px; }
  .sets-hint { display: none; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
  .ptile-check { opacity: 1; }
  .hide-sm { display: none; }
  .gallery-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .gcard-stats { gap: 4px 10px; }
  .logo-pair { grid-template-columns: 1fr; }
  .choice-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  /* Tabs wrap into pills so every tab is visible and reachable. */
  .tabs { flex-wrap: wrap; gap: 6px; border-bottom: 0; overflow: visible; }
  .tab { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
  .tab.is-active { background: var(--fg); border-color: var(--fg); color: #fff; }
  .tab.is-active .icon { color: #fff; }
  .tab.is-active em { background: rgba(255,255,255,0.18); color: #fff; }
  .tab.is-active::after { display: none; }
}
@media (max-width: 520px) {
  .gallery-cards { grid-template-columns: 1fr; }
  .logo-pair { grid-template-columns: minmax(0, 1fr); }
  .logo-slot > .field-label { min-height: 0; }
  .stat-row { gap: 8px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 19px; }
  .copy-field { flex-wrap: wrap; }
  .table th, .table td { padding: 9px 10px; }
  .auth-card { padding: 22px; }
}
