/* =========================================================
   KHADIJA — admin panel
   ========================================================= */
.admin-body { background: var(--bg-2); }

/* Login */
.login-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(160deg, #1c1815, #262019 60%, #171310);
}
.login-card {
  background: #fff; border-radius: 18px; padding: 38px 34px;
  width: min(400px, 100%); box-shadow: var(--shadow-lg);
}
.login-card .brand span { color: var(--gold); }

/* Shell */
.shell { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink); color: #b8b1a6; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { padding: 24px 22px 18px; border-bottom: 1px solid rgba(255,255,255,.09); }
.side-brand .brand { color: #fff; letter-spacing: .16em; font-family: var(--serif); font-weight: 700; }
.side-brand .brand span { color: var(--gold); }
.side-brand small { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.side-nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.side-nav button {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 11px 14px; border: none; background: none; color: #b8b1a6;
  border-radius: 9px; cursor: pointer; font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.side-nav button span { width: 18px; text-align: center; opacity: .85; }
.side-nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav button.on { background: var(--gold); color: #fff; }
.side-nav button em {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700;
  background: var(--red); color: #fff; padding: 2px 7px; border-radius: 999px;
}
.side-nav button.on em { background: rgba(0,0,0,.28); }
.side-foot { padding: 16px 18px; border-top: 1px solid rgba(255,255,255,.09); display: flex; flex-direction: column; gap: 10px; }
.side-foot a, .side-foot button {
  background: none; border: none; color: #b8b1a6; font-size: 13.5px;
  text-align: left; cursor: pointer; padding: 0;
}
.side-foot a:hover, .side-foot button:hover { color: var(--gold); }

.main { min-width: 0; display: flex; flex-direction: column; }
.admin-head {
  display: flex; align-items: center; gap: 14px; padding: 16px 28px;
  background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.admin-head h1 { font-size: 20px; }
.who { font-size: 13px; color: var(--ink-3); }
.content { padding: 28px; flex: 1; }
#sideToggle { display: none; }

/* Stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 26px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; position: relative; overflow: hidden;
}
.stat .sl { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.stat .sv { font-size: 30px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.stat .sm { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.stat::after {
  content: ''; position: absolute; right: -22px; top: -22px; width: 76px; height: 76px;
  border-radius: 50%; background: var(--gold-soft);
}
.stat.g::after { background: var(--green-soft); }
.stat.b::after { background: var(--blue-soft); }
.stat.a::after { background: var(--amber-soft); }

/* Panels & tables */
.card-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 22px; }
.cp-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.cp-head h3 { font-size: 16px; }
.cp-body { padding: 22px; }
.cp-body.flush { padding: 0; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 12px 18px; font-size: 11.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--line);
  background: var(--bg-2); white-space: nowrap;
}
.table td { padding: 13px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.tw { overflow-x: auto; }

.thumb {
  width: 42px; height: 42px; border-radius: 8px; overflow: hidden;
  background: var(--bg-3); flex-shrink: 0;
}
.thumb .ph { font-size: 18px; }
.cellflex { display: flex; align-items: center; gap: 11px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .input, .toolbar .select { width: auto; min-width: 180px; }

.dot-a { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.dot-a::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.dot-a.off::before { background: var(--ink-3); }
.dot-a.low::before { background: var(--amber); }
.dot-a.zero::before { background: var(--red); }

.rowacts { display: flex; gap: 6px; flex-wrap: wrap; }
.mini {
  font-size: 12px; padding: 5px 10px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; color: var(--ink-2); white-space: nowrap;
}
.mini:hover { border-color: var(--ink-3); background: var(--bg-2); }
.mini.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.mini.good:hover { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.mini.on { background: var(--gold); border-color: var(--gold); color: #fff; }

/* Slide-over */
.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%);
  background: #fff; z-index: 100; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-lg);
}
.side-panel.on { transform: translateX(0); }
.side-panel .drawer-body { padding: 22px; }

/* Image manager */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; margin-top: 10px; }
.img-cell { position: relative; aspect-ratio: 1; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); }
.img-cell img { width: 100%; height: 100%; object-fit: cover; }
.img-cell.primary { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.img-cell .img-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; font-size: 13px; line-height: 1;
}
.img-cell .img-badge {
  position: absolute; top: 4px; left: 4px; font-size: 9px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px;
  border-radius: 4px; background: var(--gold); color: #fff;
}
.img-tools {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex;
  background: rgba(0,0,0,.62); opacity: 0; transition: opacity .15s;
}
.img-cell:hover .img-tools { opacity: 1; }
.img-tools button {
  flex: 1; border: none; background: none; color: #fff; cursor: pointer;
  padding: 5px 0; font-size: 11px; line-height: 1;
}
.img-tools button:hover:not(:disabled) { background: rgba(255,255,255,.2); }
.img-tools button:disabled { opacity: .3; cursor: default; }

/* Settings tabs */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 24px; flex-wrap: wrap; }
.tabs button {
  padding: 11px 18px; border: none; background: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent;
}
.tabs button.on { color: var(--ink); border-color: var(--gold); }

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--line-2);
}
.switch-row:last-child { border-bottom: none; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; background: var(--line); border-radius: 99px;
  cursor: pointer; transition: background .18s;
}
.switch i::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(20px); }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 500; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 244px; z-index: 105;
    transform: translateX(-100%); transition: transform .25s;
  }
  .sidebar.on { transform: translateX(0); }
  #sideToggle { display: grid; }
  .content { padding: 18px; }
  .admin-head { padding: 14px 18px; }
}
