/* ============================================================
   BEKOFRESH – ADMIN STYLESHEET
   ============================================================ */

:root {
  --green:      #27AE60;
  --green-dark: #1E8449;
  --green-light:#D5F5E3;
  --orange:     #F39C12;
  --red:        #E74C3C;
  --red-dark:   #C0392B;
  --bg:         #F4F6F9;
  --surface:    #FFFFFF;
  --dark:       #2C3E50;
  --text:       #34495E;
  --muted:      #7F8C8D;
  --border:     #E2E8F0;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.06);
  --shadow-md:  0 6px 24px rgba(0,0,0,.10);
  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-pill:50px;
  --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
img  { max-width: 100%; display: block; }
a    { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ============================================================
   PASSWORD GATE
   ============================================================ */
.gate-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #1a6b3c 0%, #27AE60 55%, #F39C12 100%);
}

.gate-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 48px 40px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.gate-logo { height: 48px; margin: 0 auto 28px; }
.gate-title { font-size: 1.5rem; color: var(--dark); margin-bottom: 8px; }
.gate-subtitle { font-size: 14px; color: var(--muted); margin-bottom: 28px; }

.gate-back-link {
  display: inline-block;
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
  transition: color var(--transition);
}
.gate-back-link:hover { color: var(--green); }

/* ============================================================
   COMMON FORM ELEMENTS
   ============================================================ */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
}
.input-group input,
.input-group select,
.input-group textarea {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--dark);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(39,174,96,.12);
}

.password-wrap { position: relative; }
.password-wrap input { width: 100%; padding-right: 44px; }
.toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex; align-items: center; justify-content: center;
}
.toggle-pass:hover { color: var(--green); }

.login-error {
  font-size: 13px;
  color: var(--red);
  margin: -6px 0 8px;
  padding: 8px 12px;
  background: #fef2f2;
  border-radius: var(--radius-sm);
  border: 1px solid #fecaca;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-login {
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-sm);
  background: var(--green);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  margin-top: 4px;
  transition: all var(--transition);
  box-shadow: 0 3px 12px rgba(39,174,96,.3);
}
.btn-login:hover {
  background: var(--green-dark);
  box-shadow: 0 5px 18px rgba(39,174,96,.4);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(39,174,96,.25);
}
.btn-primary:hover {
  background: var(--green-dark);
  box-shadow: 0 4px 14px rgba(39,174,96,.35);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-outline:hover { border-color: var(--green); color: var(--green); }

.btn-outline-sm {
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-outline-sm:hover { border-color: var(--green); color: var(--green); }

.btn-logout {
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-logout:hover { border-color: var(--red); color: var(--red); background: #fff5f5; }

.btn-danger {
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-danger:hover { background: var(--red-dark); }

.btn-danger-outline {
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--red);
  font-size: 13.5px;
  font-weight: 500;
  border: 1.5px solid var(--red);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-danger-outline:hover { background: #fef2f2; }

.btn-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-icon.edit:hover  { border-color: var(--green); color: var(--green); background: var(--green-light); }
.btn-icon.delete:hover{ border-color: var(--red);   color: var(--red);   background: #fef2f2; }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.dashboard { min-height: 100vh; display: flex; flex-direction: column; }

/* Admin Header */
.admin-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.admin-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-header-left { display: flex; align-items: center; gap: 12px; }
.admin-logo { height: 36px; }
.admin-badge {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--green-light);
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.admin-header-right { display: flex; gap: 8px; align-items: center; }

.admin-main { flex: 1; padding: 32px 0 64px; }
.admin-container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ============================================================
   TABS
   ============================================================ */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 32px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 20px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab-btn:hover { color: var(--green); background: var(--green-light); }
.tab-btn.active {
  color: var(--green);
  border-bottom-color: var(--green);
  font-weight: 600;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   CARDS & PANELS
   ============================================================ */
.panel-header { margin-bottom: 24px; }
.panel-header h2 { font-size: 1.4rem; color: var(--dark); margin-bottom: 6px; }
.panel-header p  { font-size: 14px; color: var(--muted); }

.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card h3 { font-size: 1rem; color: var(--dark); margin-bottom: 14px; }
.hint { font-size: 13px; color: var(--muted); margin-bottom: 14px; }

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.toggle-row strong { display: block; font-size: 15px; color: var(--dark); margin-bottom: 4px; }
.toggle-row p { font-size: 13px; color: var(--muted); }

.switch { display: inline-block; position: relative; width: 52px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: #CBD5E1;
  border-radius: 28px;
  cursor: pointer;
  transition: background var(--transition);
}
.slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 4px; top: 4px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(24px); }

/* ============================================================
   SAVE FEEDBACK
   ============================================================ */
.save-feedback {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--green);
  font-weight: 500;
}
.error-feedback {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--red);
  font-weight: 500;
}

/* ============================================================
   MENU FORM
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
  margin-bottom: 20px;
}
.form-grid .span-2 { grid-column: span 2; }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================================
   ADMIN MENU LIST
   ============================================================ */
.items-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.items-list-header h3 { margin-bottom: 0; }
.items-filter select {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.items-filter select:focus { border-color: var(--green); }

.admin-menu-list { display: flex; flex-direction: column; gap: 10px; }

.admin-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: all var(--transition);
}
.admin-menu-item:hover { box-shadow: var(--shadow-sm); border-color: #c8e6c9; }

.ami-cat-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ami-names { flex: 1; min-width: 0; }
.ami-en { font-size: 14px; font-weight: 600; color: var(--dark); }
.ami-ar { font-size: 12.5px; color: var(--muted); }
.ami-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 8px;
}
.ami-actions { display: flex; gap: 6px; flex-shrink: 0; }

.items-list-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.empty-state {
  text-align: center;
  padding: 32px;
  color: var(--muted);
  font-size: 14px;
}

/* ============================================================
   BACKGROUND TAB
   ============================================================ */
.gradient-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.grad-btn {
  width: 100px; height: 60px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
  transition: all var(--transition);
  text-align: center;
  display: flex; align-items: center; justify-content: center;
  padding: 4px;
}
.grad-btn:hover { transform: scale(1.05); box-shadow: var(--shadow-md); }
.grad-btn.selected { border-color: var(--dark); box-shadow: var(--shadow-md); }

.color-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
input[type="color"] {
  width: 52px; height: 38px;
  padding: 3px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
}
input[type="color"]:focus { border-color: var(--green); }

.file-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition);
}
.file-drop-zone:hover { border-color: var(--green); background: var(--green-light); }
.file-drop-zone p { font-size: 14px; color: var(--muted); }

/* ============================================================
   DANGER ZONE
   ============================================================ */
.danger-zone { border-color: #fecaca; }
.danger-zone h3 { color: var(--red); }

/* ============================================================
   CONFIRM MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-md);
}
.modal-card h3 { font-size: 1.15rem; margin-bottom: 10px; }
.modal-card p  { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .gate-card { padding: 36px 24px 28px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .admin-main { padding: 20px 0 48px; }
  .card { padding: 18px 20px; }
  .tab-btn { padding: 10px 14px; font-size: 13px; }
  .items-list-header { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   THEME & BRANDING TAB
   ============================================================ */
.theme-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.theme-card:hover { border-color: var(--green); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.theme-card.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(39,174,96,.2), var(--shadow-md);
}
.theme-preview {
  height: 110px;
  width: 100%;
}
.theme-preview-default {
  background: linear-gradient(135deg, #1a6b3c 0%, #27AE60 50%, #F39C12 100%);
}
.theme-preview-premium {
  background:
    radial-gradient(ellipse at top, #5C0000 0%, transparent 60%),
    radial-gradient(ellipse at bottom right, #B87333 0%, transparent 50%),
    linear-gradient(135deg, #1a0808 0%, #2d0d0d 30%, #5C0000 60%, #6B4423 100%);
}
.theme-preview-luxe {
  background:
    repeating-linear-gradient(60deg, transparent 0 14px, rgba(205,127,50,0.10) 14px 15px),
    repeating-linear-gradient(-60deg, transparent 0 14px, rgba(185,28,44,0.10) 14px 15px),
    radial-gradient(ellipse at top, #6F0E18 0%, transparent 55%),
    radial-gradient(ellipse at bottom right, #CD7F32 0%, transparent 55%),
    linear-gradient(135deg, #0A0507 0%, #1F0810 50%, #2A1810 100%);
}
.theme-card-label {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.theme-card-label strong { color: var(--dark); font-size: 14px; }
.theme-card-label span   { color: var(--muted); font-size: 12px; }

/* Logo upload */
.logo-preview-row {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.logo-preview-box {
  width: 220px;
  min-height: 90px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border);
  background:
    repeating-conic-gradient(#f4f6f9 0% 25%, #e9edf2 0% 50%) 50% / 16px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}
.logo-preview-box img {
  max-width: 100%;
  max-height: 70px;
  height: auto;
  display: block;
}
.logo-upload-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.logo-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 6px;
}
input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.position-toggle {
  display: inline-flex;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  overflow: hidden;
  background: var(--bg);
  width: fit-content;
}
.pos-btn {
  padding: 8px 18px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}
.pos-btn:hover { color: var(--green); }
.pos-btn.active {
  background: var(--green);
  color: #fff;
}

.badge-premium {
  display: inline-block;
  padding: 2px 9px;
  margin-left: 6px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #C41E3A 0%, #8B0000 100%);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  vertical-align: middle;
}

.emoji-preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.emoji-preview-strip img {
  width: 32px;
  height: 32px;
  display: block;
  transition: transform var(--transition);
}
.emoji-preview-strip img:hover { transform: scale(1.25) rotate(-8deg); }

@media (max-width: 640px) {
  .theme-picker      { grid-template-columns: 1fr; }
  .logo-controls-grid{ grid-template-columns: 1fr; }
}

/* ── Chat Admin Styles ─────────────────────────────────────── */
.chat-filter-btn {
  padding: 7px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--muted); font-size: 0.82rem; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: all 0.18s;
}
.chat-filter-btn:hover { border-color: var(--green); color: var(--green); }
.chat-filter-btn.active {
  background: var(--green); border-color: var(--green);
  color: #fff;
}

.admin-room-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 8px; cursor: pointer;
  transition: all 0.15s; background: var(--bg);
}
.admin-room-row:hover { border-color: var(--green); background: rgba(39,174,96,0.04); }
.admin-room-name { font-size: 0.9rem; font-weight: 600; color: var(--dark); flex: 1; }

.admin-room-row-actions {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.admin-room-del-btn {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted); cursor: pointer;
  transition: all 0.15s; padding: 0;
  opacity: 0.4;
}
.admin-room-row:hover .admin-room-del-btn { opacity: 1; }
.admin-room-del-btn:hover {
  background: rgba(231,76,60,0.12);
  border-color: rgba(231,76,60,0.35);
  color: #e74c3c;
}

.admin-log-msg {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border);
  font-size: 0.84rem;
}
.admin-log-msg.admin-log-deleted {
  background: rgba(231, 76, 60, 0.07);
  border-color: rgba(231, 76, 60, 0.25);
}
.admin-log-nick  { font-weight: 700; color: var(--green); flex-shrink: 0; }
.admin-log-text  { color: var(--text); flex: 1; word-break: break-word; }
.admin-log-msg.admin-log-deleted .admin-log-text { color: #e74c3c; font-style: italic; }
.admin-log-time  { font-size: 0.72rem; color: var(--muted); flex-shrink: 0; }

/* ── Coming Soon image editor ─────────────────────────────── */
.cs-img-editor { margin-top: 4px; }

.cs-img-preview-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: crosshair;
  user-select: none;
}

.cs-img-preview-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a6b3c 0%, #27AE60 60%, #F39C12 100%);
}

/* Mirror the premium bg in the preview when premium theme is active */
body.theme-premium .cs-img-preview-bg {
  background: linear-gradient(135deg, #0F0808 0%, #5C0000 55%, #6B4423 100%);
}

.cs-img-node {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%) scale(1);
  cursor: grab;
  touch-action: none;
}
.cs-img-node:active { cursor: grabbing; }

.cs-img-node img {
  max-width: 180px;
  max-height: 140px;
  display: block;
  pointer-events: none;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}


/* -- Analytics tab --------------------------------------- */
.stat-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(140px, 1fr)); gap:12px; }
.stat { background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08); border-radius:10px; padding:14px; text-align:center; }
.stat-num { font-size:1.8rem; font-weight:700; color:var(--accent, #ffb84d); }
.stat-lbl { font-size:0.78rem; opacity:0.75; margin-top:4px; text-transform:uppercase; letter-spacing:0.04em; }
.admin-table { width:100%; border-collapse:collapse; font-size:0.85rem; }
.admin-table th, .admin-table td { padding:8px 10px; border-bottom:1px solid rgba(255,255,255,0.08); text-align:left; }
.admin-table th { background:rgba(255,255,255,0.04); font-weight:600; opacity:0.85; }
.admin-table code { font-size:0.78rem; opacity:0.85; }
.analytics-summary { min-height:60px; }

/* -- Save-changes banner ----------------------------------- */
.beko-savebar {
  position: fixed;
  top: -80px;
  left: 0; right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: linear-gradient(90deg, #2c7a4b, #1f5c38);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  transition: top .25s ease;
  font-family: inherit;
}
.beko-savebar.show { top: 0; }
body.has-savebar { padding-top: 56px; }
.beko-savebar__msg { font-size: 0.95rem; }
.beko-savebar__count { opacity: 0.85; margin-left: 6px; font-weight: 400; }
.beko-savebar__actions { display: flex; gap: 8px; }
.beko-savebar__btn,
.beko-savebar__discard {
  border: 0;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}
.beko-savebar__btn { background: #fff; color: #1f5c38; }
.beko-savebar__btn:hover:not(:disabled) { background: #f3f3f3; }
.beko-savebar__btn:disabled { opacity: 0.6; cursor: wait; }
.beko-savebar__discard {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.beko-savebar__discard:hover { background: rgba(255,255,255,0.22); }
.beko-savebar--ok  { background: linear-gradient(90deg, #2c7a4b, #1a8f5a); }
.beko-savebar--err { background: linear-gradient(90deg, #b53939, #8a2828); }

/* ============================================================
   ACCOUNTS TAB
   ============================================================ */

/* ============================================================
   STACKED PERMISSION EDITOR (rev. 2)
   ============================================================ */
.acc-perm-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.acc-perm-card {
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
}
.acc-perm-cat-title {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: #6b7280; margin-bottom: 8px;
}
.acc-perm-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 14px;
}
.acc-perm-item {
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; color: #374151; cursor: pointer; padding: 4px 0;
}
.acc-perm-item.is-disabled { opacity: .55; cursor: not-allowed; }
.acc-perm-item.is-full-only { color: #6b21a8; }
.acc-perm-full-tag {
  display: inline-block; margin-left: auto;
  font-size: .6rem; font-weight: 800; letter-spacing: .08em;
  background: #f3e8ff; color: #6b21a8;
  padding: 2px 6px; border-radius: 6px;
}
.acc-perm-hint {
  font-size: .72rem; color: #6b7280; font-weight: 400; margin: 4px 0 0;
}

/* Roles row (multi-select pills above the categories) */
.acc-perm-roles {
  background: #fff7ed; border: 1.5px solid #fed7aa;
  border-radius: 10px; padding: 12px 14px; margin-bottom: 6px;
}
.acc-perm-roles h5 {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: #9a3412; margin-bottom: 8px;
}
.role-pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.role-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1.5px solid #fed7aa;
  border-radius: 999px; padding: 5px 12px;
  font-size: .82rem; cursor: pointer; transition: all .15s ease;
}
.role-pill:has(input:checked) { background: #c2410c; color: #fff; border-color: #c2410c; }
.role-pill input { accent-color: #c2410c; cursor: pointer; }
.role-pill-disabled { opacity: .45; cursor: not-allowed; }

/* Master Full Administrator toggle (caller must already hold it) */
.acc-perm-full {
  background: linear-gradient(135deg, #fef2f2 0%, #fff7ed 100%);
  border: 1.5px solid #fca5a5;
}
.acc-perm-full-row {
  display: flex; align-items: center; gap: 14px; justify-content: space-between;
}
.acc-perm-full-text { flex: 1; min-width: 0; }
.acc-perm-full-label {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; cursor: pointer;
}
.full-admin-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #7c2d12; color: #fff;
  padding: 4px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; letter-spacing: .02em;
}
.full-admin-warn {
  display: inline-block;
  width: 18px; height: 18px; line-height: 18px;
  text-align: center; font-size: .9rem;
  background: #fbbf24; color: #78350f;
  border-radius: 50%; cursor: help;
}

/* iOS-style switch (used for the Full Administrator master toggle and
   any other binary toggle in the admin UI, e.g. dark-mode). */
.beko-switch {
  display: inline-flex; align-items: center; flex-shrink: 0;
  position: relative; cursor: pointer; user-select: none;
}
.beko-switch input { position: absolute; opacity: 0; pointer-events: none; }
.beko-switch-track {
  width: 52px; height: 30px; border-radius: 999px;
  background: #d1d5db; position: relative;
  transition: background .18s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.08);
}
.beko-switch-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.2);
  transition: transform .18s ease, background .18s ease;
}
.beko-switch input:checked + .beko-switch-track {
  background: linear-gradient(135deg, #c2410c, #7c2d12);
}
.beko-switch input:checked + .beko-switch-track .beko-switch-thumb {
  transform: translateX(22px);
  background: #fff7ed;
}
.beko-switch input:focus-visible + .beko-switch-track {
  outline: 2px solid #fbbf24; outline-offset: 2px;
}

/* When Full Administrator is on, dim the per-permission checkboxes and
   show a subtle banner — they're now driven by the master switch. */
.acc-perm-grid.full-on .acc-perm-card:not(.acc-perm-full):not(.acc-perm-roles),
[id$="PermGrid"].full-on .acc-perm-card:not(.acc-perm-full):not(.acc-perm-roles) {
  opacity: .55; pointer-events: none;
  position: relative;
}
[id$="PermGrid"].full-on .acc-perm-card:not(.acc-perm-full):not(.acc-perm-roles)::after {
  content: 'Granted by Full Administrator';
  position: absolute; top: 8px; right: 12px;
  font-size: .65rem; font-weight: 700; letter-spacing: .05em;
  color: #7c2d12; text-transform: uppercase;
}

/* Account row cards */
.acc-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid #f3f4f6;
}
.acc-row:last-child { border-bottom: none; }
.acc-row-owner {
  background: linear-gradient(90deg, #fef3c7 0%, transparent 60%);
  border-radius: 10px; padding: 14px;
  border: 1.5px dashed #fbbf24;
  margin-bottom: 6px;
}
.acc-locked-tag {
  display: inline-block; margin-left: 6px;
  font-size: .65rem; font-weight: 700; letter-spacing: .05em;
  background: #fbbf24; color: #78350f;
  padding: 2px 6px; border-radius: 6px; vertical-align: middle;
}
.acc-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; text-transform: uppercase;
}
.acc-avatar-owner { background: linear-gradient(135deg, #fbbf24, #c2410c); font-size: 1.4rem; }
.acc-info { flex: 1; min-width: 0; }
.acc-name  { font-weight: 600; font-size: .9rem; }
.acc-email { font-size: .78rem; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-meta  { font-size: .72rem; color: #9ca3af; margin-top: 2px; }
.acc-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.acc-badge {
  display: inline-block; border-radius: 8px; padding: 2px 8px;
  font-size: .68rem; font-weight: 600;
}
.acc-badge-role   { background: #d1fae5; color: #065f46; }
.acc-badge-temp   { background: #fef3c7; color: #92400e; }
.acc-badge-inactive { background: #f3f4f6; color: #9ca3af; }
.acc-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Deleted chat-room rows — visually distinct from live rooms */
.admin-room-row-deleted {
  background: #fef2f2;
  border-left: 3px solid #f87171;
}
.admin-room-row-deleted .admin-room-name { color: #991b1b; }
.admin-room-meta {
  font-size: .72rem; color: #9ca3af;
}

/* Expanded edit panel */
.acc-edit-panel {
  background: #f9fafb; border: 1.5px solid #e5e7eb; border-radius: 10px;
  padding: 16px; margin-top: 10px; display: none;
}
.acc-edit-panel.open { display: block; }

/* Tickets link in sidebar should look like a tab but not activate like one */
nav .tab-btn[href] {
  text-decoration: none;
  color: var(--text-muted);
}
nav .tab-btn[href]:hover {
  color: var(--green);
  background: var(--green-light);
}

/* ============================================================
   PROFILE MENU
   ============================================================ */
.profile-menu-wrap {
  position: relative;
}
.profile-avatar-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--green); color: #fff;
  border: none; cursor: pointer; font-weight: 700; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s;
}
.profile-avatar-btn:hover { opacity: .85; }
.profile-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0;
  width: 260px; background: #fff;
  border: 1.5px solid #e5e7eb; border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 999; overflow: hidden;
}
.profile-dropdown.hidden { display: none; }
.profile-dropdown-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid #f3f4f6;
  display: flex; flex-direction: column; gap: 2px;
}
.profile-dropdown-form {
  padding: 12px 14px 14px;
}

/* ============================================================
   PROFILE DROPDOWN MENU (post-overhaul: settings link + dark mode)
   ============================================================ */
.profile-dropdown-menu {
  display: flex; flex-direction: column; padding: 6px 0;
}
.profile-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: none; border: none;
  font-size: .85rem; color: #374151; cursor: pointer;
  text-align: left; width: 100%;
  transition: background .12s ease;
}
.profile-menu-item:hover {
  background: var(--green-light, #d5f5e3);
  color: var(--green-dark, #1e8449);
}
.profile-menu-toggle { cursor: default; }
.profile-menu-toggle:hover { background: transparent; color: inherit; }

/* Smaller switch variant for inline menu items */
.beko-switch-sm .beko-switch-track { width: 38px; height: 22px; }
.beko-switch-sm .beko-switch-thumb { width: 18px; height: 18px; top: 2px; left: 2px; }
.beko-switch-sm input:checked + .beko-switch-track .beko-switch-thumb {
  transform: translateX(16px);
}
.beko-switch-sm input:checked + .beko-switch-track {
  background: linear-gradient(135deg, #1e8449, #065f46);
}

/* ============================================================
   GENERIC MODAL (used by Profile Settings)
   ============================================================ */
.beko-modal {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.beko-modal.hidden { display: none; }
.beko-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
}
.beko-modal-panel {
  position: relative;
  width: 100%; max-width: 520px;
  max-height: calc(100vh - 40px);
  background: #fff; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.30);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.beko-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #f3f4f6;
}
.beko-modal-header h3 { margin: 0; font-size: 1.05rem; }
.beko-modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: none; cursor: pointer;
  font-size: 1.5rem; color: #6b7280;
}
.beko-modal-close:hover { background: #f3f4f6; }
.beko-modal-body {
  padding: 18px 20px; overflow-y: auto; flex: 1;
}
.beko-modal-footer {
  padding: 12px 20px; border-top: 1px solid #f3f4f6;
  display: flex; align-items: center; gap: 10px; justify-content: flex-end;
}
.beko-section-title {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #6b7280;
  margin: 14px 0 8px;
}
.beko-section-title:first-child { margin-top: 0; }
.beko-field-hint {
  display: block; margin-top: 4px;
  font-size: .72rem; color: #9ca3af;
}
.beko-info-banner {
  background: #fff7ed; border: 1px solid #fed7aa;
  color: #9a3412; padding: 10px 12px; border-radius: 8px;
  font-size: .8rem; margin-bottom: 14px;
}
.beko-info-banner.hidden { display: none; }
.beko-save-status { font-size: .78rem; color: #059669; flex: 1; }
.beko-save-status.error { color: #b91c1c; }

/* ============================================================
   PENDING-CHANGE QUEUE (Accounts tab) + per-user pending pills
   ============================================================ */
.pending-change-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid #fed7aa;
  background: #fff7ed; border-radius: 10px; margin-bottom: 8px;
}
.pending-change-info { flex: 1; min-width: 0; font-size: .85rem; }
.pending-change-info strong { color: #9a3412; }
.pending-change-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pending-change-meta { font-size: .72rem; color: #9a3412; opacity: .8; margin-top: 2px; }
.pending-pill {
  display: inline-block; padding: 2px 8px; border-radius: 8px;
  font-size: .68rem; font-weight: 700; letter-spacing: .04em;
  background: #fed7aa; color: #9a3412;
}

/* ============================================================
   DARK MODE (admin panel only — opt-in via profile dropdown).
   Per-device preference stored in localStorage as bekoAdminDark.
   ============================================================ */
body.admin-dark {
  --green-light: #1f3a2c;
  --text-muted: #9ca3af;
  background: #0f172a;
  color: #e5e7eb;
}
body.admin-dark .admin-header,
body.admin-dark .card,
body.admin-dark .acc-edit-panel,
body.admin-dark .beko-modal-panel,
body.admin-dark .profile-dropdown,
body.admin-dark .acc-perm-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e5e7eb !important;
}
body.admin-dark .admin-main { background: #0f172a; }
body.admin-dark h1, body.admin-dark h2, body.admin-dark h3,
body.admin-dark h4, body.admin-dark h5, body.admin-dark label,
body.admin-dark p, body.admin-dark .acc-name, body.admin-dark .acc-email,
body.admin-dark .acc-perm-cat-title, body.admin-dark .acc-perm-item,
body.admin-dark .profile-menu-item, body.admin-dark .beko-modal-header h3 {
  color: #e5e7eb;
}
body.admin-dark .acc-meta,
body.admin-dark .beko-field-hint,
body.admin-dark #profileDropUsername,
body.admin-dark #profileDropEmail,
body.admin-dark .acc-perm-hint {
  color: #94a3b8;
}
body.admin-dark input,
body.admin-dark textarea,
body.admin-dark select {
  background: #0f172a !important; color: #e5e7eb !important;
  border-color: #475569 !important;
}
body.admin-dark .tab-btn { color: #cbd5e1; }
body.admin-dark .tab-btn.active,
body.admin-dark .tab-btn:hover { background: #334155; color: #fff; }
body.admin-dark .acc-perm-roles { background: #3a2a1a; border-color: #92400e; }
body.admin-dark .profile-menu-item:hover { background: #334155; color: #fff; }
body.admin-dark .acc-row { border-color: #334155; }
body.admin-dark .beko-modal-backdrop { background: rgba(0,0,0,.7); }
body.admin-dark .beko-info-banner { background: #422006; border-color: #92400e; color: #fcd34d; }
body.admin-dark .beko-modal-header,
body.admin-dark .beko-modal-footer { border-color: #334155; }
body.admin-dark .beko-modal-close { color: #cbd5e1; }
body.admin-dark .beko-modal-close:hover { background: #334155; }
