/* مكتبة خطوة — هوية خطوة (tokens: Khotwa 1.12.8/4032) */
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('fonts/IBMPlexSansArabic-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('fonts/IBMPlexSansArabic-SemiBold.ttf') format('truetype');
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  --lime: #C4F43B; --deep: #20290F; --ink: #242B18; --mint: #BDD69A;
  --ivory: #F5F6EF; --night: #10130D; --paperDark: #1D2417; --white: #F3F6EF;
  --muted: #A7B8AE; --border: #35483D;
  --r-card: 24px; --r-btn: 16px; --r-input: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #0D100C; }
body {
  margin: 0;
  font-family: 'IBM Plex Sans Arabic', system-ui, 'Segoe UI', Tahoma, sans-serif;
  color: var(--white);
  min-height: 100vh;
  line-height: 1.7;
}
/* خلفية متدرجة ثابتة تغطي المحتوى كله — background-attachment:fixed يفشل على الموبايل */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, #353D16 0%, #171D10 38%, #0D100C 100%);
}

.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 64px; }

header.top {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 4px 8px;
}
header.top img.logo { width: 56px; height: 56px; border-radius: 14px; }
header.top .brand h1 { font-size: 22px; font-weight: 600; margin: 0; }
header.top .brand .tag { font-size: 12.5px; color: var(--mint); margin: 0; }

.card {
  background: var(--paperDark);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 16px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px;
  border-radius: var(--r-btn); border: 1px solid transparent;
  font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  background: var(--lime); color: var(--deep);
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; color: var(--mint); border-color: var(--border); }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 14px; }
.btn.danger { background: transparent; color: #F19A9A; border-color: #5A3535; }
.btn[disabled] { opacity: .55; cursor: default; }

input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 52px; padding: 0 16px;
  border-radius: var(--r-input); border: 1px solid var(--border);
  background: #0D100C; color: var(--white);
  font-family: inherit; font-size: 15px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--lime); outline-offset: -1px; }
label { display: block; font-size: 14px; color: var(--mint); margin: 14px 0 6px; }

.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }

.searchbar { margin: 12px 0 4px; }

.subject-block { margin-top: 20px; }
.subject-block h2 {
  font-size: 16px; font-weight: 600; color: var(--mint);
  margin: 0 4px 10px; display: flex; align-items: center; gap: 8px;
}
.subject-block h2 .count { font-size: 12px; color: var(--muted); font-weight: 400; }

.file-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 8px;
  background: var(--paperDark); border: 1px solid var(--border);
  border-radius: 18px;
}
.file-item .ficon { width: 34px; text-align: center; flex-shrink: 0; color: var(--mint); display: flex; align-items: center; justify-content: center; }
.file-item .ficon svg { width: 26px; height: 26px; }
.file-item .fmeta { flex: 1; min-width: 0; }
.file-item .ftitle { font-size: 15px; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.file-item .fsub { font-size: 12.5px; color: var(--muted); margin: 2px 0 0; }
.file-item .factions { display: flex; gap: 6px; flex-shrink: 0; }
.file-item .factions .btn { min-height: 40px; padding: 0 12px; font-size: 13px; }

.empty { text-align: center; padding: 48px 16px; }
.empty .big svg { width: 42px; height: 42px; color: var(--muted); }

.toast {
  position: fixed; bottom: 20px; right: 16px; left: 16px;
  max-width: 480px; margin: 0 auto;
  background: var(--deep); color: var(--white);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 16px; font-size: 14px; z-index: 50;
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
}
.toast.err { border-color: #5A3535; color: #F6C9C9; }

.progress-track { height: 8px; background: #0D100C; border-radius: 99px; overflow: hidden; margin-top: 10px; }
@media (prefers-reduced-motion: reduce) {
  .progress-fill { transition-duration: 0s; }
}
.progress-fill { height: 100%; width: 0%; background: var(--lime); border-radius: 99px; transition: width 220ms linear; }

.dropzone {
  border: 2px dashed var(--border); border-radius: var(--r-card);
  padding: 26px 16px; text-align: center; color: var(--muted);
  cursor: pointer;
}
.dropzone.over { border-color: var(--lime); color: var(--mint); }
.dropzone .big { color: var(--mint); }

.admin-list .file-item .factions { flex-wrap: wrap; justify-content: flex-end; }

header.adminbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 4px 8px; }
header.adminbar .side { display: flex; align-items: center; gap: 10px; }
header.adminbar img.logo { width: 44px; height: 44px; border-radius: 12px; }
header.adminbar h1 { font-size: 18px; margin: 0; }

footer.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 28px 0 8px; }
footer.foot a { color: var(--mint); }

.stat-row { display: flex; gap: 8px; margin: 12px 0; }
.stat-pill {
  flex: 1; text-align: center; padding: 10px 6px;
  background: var(--paperDark); border: 1px solid var(--border); border-radius: 16px;
}
.stat-pill .num { font-size: 18px; font-weight: 600; color: var(--lime); }
.stat-pill .lbl { font-size: 11.5px; color: var(--muted); }
