/* ============================================================
   لوحة متابعة مشاريع تقنية المعلومات — التصميم الرئيسي
   Design tokens:
   Ink Navy #0B2545 | Deep Teal #0F6E6E | Teal Light #14A3A3
   Amber #E9A23B | Success Green #2E7D32 | Slate #64748B
   Cloud #F5F7FA | Card #FFFFFF | Border #E3E8EF
   ============================================================ */

:root {
  --ink: #0B2545;
  --teal: #0F6E6E;
  --teal-light: #14A3A3;
  --amber: #E9A23B;
  --green: #2E7D32;
  --red: #C0392B;
  --slate: #64748B;
  --cloud: #F5F7FA;
  --card: #FFFFFF;
  --border: #E3E8EF;
  --radius: 14px;
  --shadow-sm: 0 1px 3px rgba(11,37,69,.06), 0 1px 2px rgba(11,37,69,.08);
  --shadow-md: 0 8px 24px rgba(11,37,69,.10);
  --font-display: 'Tajawal', 'IBM Plex Sans Arabic', sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'Tajawal', sans-serif;
}

/* الوضع الداكن — يُفعَّل عبر data-theme="dark" على <html> */
html[data-theme="dark"] {
  --ink: #EAF1F8;
  --slate: #93A5B8;
  --cloud: #0B1524;
  --card: #101E33;
  --border: #223350;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 12px 28px rgba(0,0,0,.35);
}
html[data-theme="dark"] body { background: var(--cloud); }
html[data-theme="dark"] .site-header { background: #081120; }
html[data-theme="dark"] .toolbar,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .meta-item,
html[data-theme="dark"] .detail-header,
html[data-theme="dark"] .doc-item,
html[data-theme="dark"] table.data-table { background: var(--card); }
html[data-theme="dark"] .search-box input { background: #0B1524; color: var(--ink); }
html[data-theme="dark"] .search-box input:focus { background: var(--card); }
html[data-theme="dark"] .filter-tabs button { background: var(--card); color: var(--slate); }
html[data-theme="dark"] .status-current { background: rgba(20,163,163,.15); }
html[data-theme="dark"] .status-closed { background: rgba(46,125,50,.18); }
html[data-theme="dark"] .status-hold { background: rgba(233,162,59,.18); }
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .breadcrumb,
html[data-theme="dark"] .brand-sub { color: var(--slate); }

/* انتقالات سلسة بين الصفحات (View Transitions API) — تدعمها المتصفحات الحديثة تلقائياً وتتجاهلها البقية */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: fadeOutSlide .22s ease both; }
::view-transition-new(root) { animation: fadeInSlide .28s ease both; }
@keyframes fadeOutSlide { to { opacity: 0; transform: translateY(-6px); } }
@keyframes fadeInSlide { from { opacity: 0; transform: translateY(6px); } }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--cloud);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  margin: 0;
}

:focus-visible {
  outline: 3px solid var(--teal-light);
  outline-offset: 2px;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ================= الترويسة العامة ================= */
.site-header {
  background: var(--ink);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand img.logo {
  height: 42px;
  width: 42px;
  border-radius: 10px;
  object-fit: cover;
  background: #fff;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
}
.brand-sub {
  font-size: .78rem;
  color: #AEC3D9;
}
.header-actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  color: #DCE7F0;
  border: 1px solid rgba(255,255,255,.25);
  padding: 8px 16px;
  border-radius: 999px;
  transition: all .2s ease;
}
.header-actions a:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.5);
}

/* ================= الهيرو / الإحصائيات ================= */
.hero {
  background: linear-gradient(160deg, var(--ink) 0%, #123a63 55%, var(--teal) 130%);
  color: #fff;
  padding: 48px 0 84px;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  letter-spacing: .04em;
  color: #B9E4E4;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero-eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal-light);
  box-shadow: 0 0 0 0 rgba(20,163,163,.6);
  animation: pulse 2s infinite;
}
.hero h1 {
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
  max-width: 720px;
}
.hero p.lead {
  color: #C9D9E8;
  max-width: 640px;
  margin-top: 12px;
  font-size: 1rem;
}

.stats-band {
  margin-top: 34px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat-tile {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-tile .num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}
.stat-tile .label {
  margin-top: 8px;
  font-size: .82rem;
  color: #C9D9E8;
}
.stat-tile.accent-teal .num { color: #6FE3C9; }
.stat-tile.accent-amber .num { color: #FFD08A; }
.stat-tile.accent-green .num { color: #8FE0A6; }

/* ================= أدوات الفلترة ================= */
.toolbar {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 18px 22px;
  margin-top: -50px;
  position: relative;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
}
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-tabs button {
  font-family: var(--font-body);
  font-size: .86rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--slate);
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s ease;
}
.filter-tabs button:hover { border-color: var(--teal-light); color: var(--teal); }
.filter-tabs button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.search-box {
  position: relative;
  min-width: 240px;
  flex: 1 1 240px;
  max-width: 340px;
}
.search-box input {
  width: 100%;
  font-family: var(--font-body);
  padding: 10px 40px 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .88rem;
  background: var(--cloud);
}
.search-box input:focus { background: #fff; }
.search-box .icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate);
  font-size: .95rem;
  pointer-events: none;
}

/* ================= شبكة المشاريع ================= */
.section-title {
  margin: 40px 0 18px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.section-title h2 { font-size: 1.25rem; }
.section-title span { color: var(--slate); font-size: .85rem; }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding-bottom: 60px;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.card-top .info { flex: 1; min-width: 0; }
.dept-tag {
  font-size: .72rem;
  color: var(--teal);
  font-weight: 700;
  margin-bottom: 6px;
  display: block;
}
.project-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--ink);
  display: block;
  transition: color .15s ease;
}
.project-card:hover .project-name { color: var(--teal); }
.project-summary {
  font-size: .86rem;
  color: var(--slate);
  margin-top: 6px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* حلقة نسبة الإنجاز (SVG) */
.progress-ring { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring circle.bg { stroke: var(--border); fill: none; }
.progress-ring circle.fg { fill: none; stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.progress-ring .pct {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .82rem;
  color: var(--ink);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .74rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  width: fit-content;
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.status-current { background: #E6F5F5; color: var(--teal); }
.status-current .dot { background: var(--teal-light); animation: pulse 2s infinite; }
.status-closed { background: #E9F5EA; color: var(--green); }
.status-closed .dot { background: var(--green); }
.status-hold { background: #FDF1E0; color: #B9791F; }
.status-hold .dot { background: var(--amber); }

.card-bottom {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  color: var(--slate);
}
.card-bottom b { color: var(--ink); font-weight: 600; }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--slate);
}
.empty-state .emoji { font-size: 2.4rem; margin-bottom: 10px; }

/* ================= صفحة تفاصيل المشروع ================= */
.breadcrumb {
  font-size: .85rem;
  color: var(--slate);
  margin: 22px 0;
}
.breadcrumb a { color: var(--teal); }

.detail-header {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 26px;
  align-items: center;
  flex-wrap: wrap;
}
.detail-header .ring-lg { width: 108px; height: 108px; flex-shrink: 0; }
.detail-header .ring-lg .pct { font-size: 1.3rem; }
.detail-header .info { flex: 1; min-width: 240px; }
.detail-header h1 { font-size: 1.5rem; margin-bottom: 8px; }
.detail-header .desc { color: var(--slate); font-size: .92rem; max-width: 680px; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 24px 0;
}
.meta-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.meta-item .label { font-size: .74rem; color: var(--slate); margin-bottom: 6px; }
.meta-item .value { font-weight: 700; font-size: .94rem; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.panel h3 { font-size: 1.05rem; margin-bottom: 18px; display:flex; align-items:center; gap:8px; }

/* الخط الزمني للمراحل */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding-right: 34px;
  padding-bottom: 26px;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: '';
  position: absolute;
  right: 8px; top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: #fff;
  z-index: 2;
}
.timeline li::after {
  content: '';
  position: absolute;
  right: 14px; top: 18px;
  bottom: -10px;
  width: 2px;
  background: var(--border);
}
.timeline li:last-child::after { display: none; }
.timeline li.step-done::before { border-color: var(--green); background: var(--green); }
.timeline li.step-progress::before { border-color: var(--teal-light); background: var(--teal-light); }
.step-title { font-weight: 700; font-size: .95rem; display: flex; align-items:center; gap:10px; flex-wrap: wrap; }
.step-desc { color: var(--slate); font-size: .85rem; margin-top: 4px; }
.step-badge {
  font-size: .68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.step-done .step-badge { background: #E9F5EA; color: var(--green); }
.step-progress .step-badge { background: #E6F5F5; color: var(--teal); }
.step-pending .step-badge { background: #F0F1F5; color: var(--slate); }

/* المستندات */
.doc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.doc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color .15s ease, background .15s ease;
}
.doc-item:hover { border-color: var(--teal-light); background: #FAFDFD; }
.doc-item .ico { font-size: 1.4rem; }
.doc-item .meta { flex: 1; min-width: 0; }
.doc-item .fname { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-item .fsize { font-size: .76rem; color: var(--slate); }
.doc-item .dl-btn {
  font-size: .78rem;
  font-weight: 700;
  color: var(--teal);
  border: 1px solid var(--teal-light);
  padding: 6px 14px;
  border-radius: 999px;
  flex-shrink: 0;
}
.doc-item .dl-btn:hover { background: var(--teal); color: #fff; }

/* ================= شريط التحميل العلوي ================= */
#top-loader {
  position: fixed; top: 0; right: 0; left: 0; height: 3px;
  background: linear-gradient(90deg, var(--teal-light), var(--teal));
  width: 0%; z-index: 9999; opacity: 0;
  transition: width .3s ease, opacity .2s ease;
}
#top-loader.active { opacity: 1; }

/* ================= زر تبديل الوضع الداكن ================= */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.06);
  cursor: pointer; font-size: 1rem; color: #fff;
  transition: all .18s ease;
}
.theme-toggle:hover { background: rgba(255,255,255,.16); }

/* ================= شريط توزيع الحالات (مؤشر تنفيذي) ================= */
.distribution-bar {
  display: flex; height: 10px; border-radius: 999px; overflow: hidden;
  background: var(--border); margin-top: 18px; max-width: 420px;
}
.distribution-bar span { height: 100%; transition: width .6s ease; }
.distribution-bar .seg-current { background: var(--teal-light); }
.distribution-bar .seg-closed { background: var(--green); }
.distribution-bar .seg-hold { background: var(--amber); }
.distribution-legend { display: flex; gap: 18px; margin-top: 10px; flex-wrap: wrap; }
.distribution-legend span { font-size: .76rem; color: #C9D9E8; display: flex; align-items: center; gap: 6px; }
.distribution-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ================= رسوم دخول متدرّجة لبطاقات المشاريع ================= */
.project-card {
  animation: cardIn .45s ease both;
}
.projects-grid .project-card:nth-child(1) { animation-delay: .03s; }
.projects-grid .project-card:nth-child(2) { animation-delay: .08s; }
.projects-grid .project-card:nth-child(3) { animation-delay: .13s; }
.projects-grid .project-card:nth-child(4) { animation-delay: .18s; }
.projects-grid .project-card:nth-child(5) { animation-delay: .23s; }
.projects-grid .project-card:nth-child(6) { animation-delay: .28s; }
.projects-grid .project-card:nth-child(n+7) { animation-delay: .32s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .project-card, ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}

/* ================= تبويبات صفحة تفاصيل المشروع ================= */
.tabs-nav {
  display: flex; gap: 6px; border-bottom: 1px solid var(--border);
  margin: 28px 0 0; overflow-x: auto;
}
.tabs-nav button {
  font-family: var(--font-body);
  background: none; border: none; cursor: pointer;
  padding: 12px 18px; font-size: .9rem; font-weight: 700;
  color: var(--slate); position: relative; white-space: nowrap;
}
.tabs-nav button.active { color: var(--teal); }
.tabs-nav button.active::after {
  content: ''; position: absolute; right: 0; left: 0; bottom: -1px; height: 3px;
  background: var(--teal); border-radius: 3px 3px 0 0;
}
.tab-panel { display: none; animation: fadeInSlide .3s ease both; }
.tab-panel.active { display: block; }

/* رأس مصغّر لاصق يظهر أثناء التمرير في صفحة التفاصيل */
.sticky-header {
  position: fixed; top: 0; right: 0; left: 0; z-index: 45;
  background: var(--ink); color: #fff;
  padding: 12px 0; transform: translateY(-100%);
  transition: transform .25s ease; box-shadow: var(--shadow-md);
}
.sticky-header.show { transform: translateY(0); }
.sticky-header .container { display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.sticky-header .s-name { font-family: var(--font-display); font-weight: 700; font-size: .95rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sticky-header .mini-ring { width: 34px; height: 34px; flex-shrink: 0; }
.sticky-header .mini-ring .pct { font-size: .6rem; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .85rem; font-weight: 700; color: var(--teal);
  padding: 8px 4px; transition: gap .15s ease;
}
.back-link:hover { gap: 10px; }

/* ================= تنبيهات Toast (لوحة التحكم) ================= */
.toast-stack {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 9998; display: flex; flex-direction: column; gap: 10px;
  width: min(92vw, 420px);
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 12px; padding: 14px 16px;
  box-shadow: var(--shadow-md); border-right: 4px solid var(--teal);
  font-size: .87rem; animation: toastIn .3s ease both;
}
.toast.toast-error { border-color: var(--red); }
.toast .icon { font-size: 1.1rem; }
.toast .close-toast { margin-right: auto; cursor: pointer; color: var(--slate); background:none; border:none; font-size: 1rem; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: translateY(0); } }
.toast.hide { animation: toastOut .25s ease both; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ================= نافذة تأكيد مخصصة (بدلاً من confirm الافتراضية) ================= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11,37,69,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-box {
  background: #fff; border-radius: 16px; padding: 28px; max-width: 380px; width: 92vw;
  text-align: center; transform: scale(.92); transition: transform .2s ease;
  box-shadow: var(--shadow-md);
}
.modal-overlay.show .modal-box { transform: scale(1); }
.modal-box .emoji { font-size: 2rem; margin-bottom: 10px; }
.modal-box h3 { font-size: 1.05rem; margin-bottom: 8px; }
.modal-box p { color: var(--slate); font-size: .87rem; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; justify-content: center; }

/* ================= طباعة صفحة تفاصيل المشروع ================= */
@media print {
  .site-header, .site-footer, .breadcrumb, .sticky-header, .header-actions,
  .theme-toggle, #top-loader, .tabs-nav, .print-btn, .back-link { display: none !important; }
  .tab-panel { display: block !important; }
  body { background: #fff; }
  .panel, .detail-header { box-shadow: none; border: 1px solid #ccc; }
}

/* ================= الفوتر ================= */
.site-footer {
  background: var(--ink);
  color: #B9C8D8;
  text-align: center;
  padding: 22px 0;
  font-size: .82rem;
  margin-top: 40px;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(20,163,163,.55); }
  70% { box-shadow: 0 0 0 8px rgba(20,163,163,0); }
  100% { box-shadow: 0 0 0 0 rgba(20,163,163,0); }
}

/* ================= استجابة للشاشات الصغيرة ================= */
@media (max-width: 980px) {
  .stats-band { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .meta-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .projects-grid { grid-template-columns: 1fr; }
  .stats-band { grid-template-columns: repeat(2, 1fr); }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .toolbar { margin-top: -30px; flex-direction: column; align-items: stretch; }
  .detail-header { flex-direction: column; align-items: flex-start; text-align: right; }
}

/* ================= لوحة التحكم (Admin) ================= */
.admin-body { background: var(--cloud); min-height: 100vh; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px;
  background: var(--ink);
  color: #fff;
  flex-shrink: 0;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-sidebar .brand { margin-bottom: 30px; padding: 0 8px; }
.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav a {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: .88rem;
  color: #C9D9E8;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all .15s ease;
}
.admin-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-nav a.active { background: var(--teal); color: #fff; }
.admin-main { flex: 1; padding: 28px 32px; min-width: 0; }
.admin-topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.admin-topbar h1 { font-size: 1.4rem; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body);
  font-size: .86rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: #0C5B5B; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--teal-light); color: var(--teal); }
.btn-danger { background: #FCEBEA; color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: .78rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }

table.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data-table th {
  text-align: right; padding: 12px 14px; color: var(--slate);
  font-size: .76rem; border-bottom: 1px solid var(--border);
}
table.data-table td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: #FAFBFD; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: .84rem; font-weight: 700; color: var(--ink); }
.form-group .hint { font-size: .74rem; color: var(--slate); }
input[type=text], input[type=password], input[type=date], input[type=number],
input[type=file], select, textarea {
  font-family: var(--font-body);
  font-size: .9rem;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: var(--teal-light); }

.alert { padding: 12px 16px; border-radius: 10px; font-size: .86rem; margin-bottom: 18px; }
.alert-success { background: #E9F5EA; color: var(--green); }
.alert-error { background: #FCEBEA; color: var(--red); }

.badge-count {
  background: rgba(255,255,255,.12);
  font-size: .72rem;
  padding: 2px 9px;
  border-radius: 999px;
  margin-right: auto;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--ink) 0%, #123a63 55%, var(--teal) 130%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.login-card img.logo { height: 56px; margin: 0 auto 14px; border-radius: 12px; }
.login-card h1 { font-size: 1.2rem; margin-bottom: 4px; }
.login-card p.sub { color: var(--slate); font-size: .85rem; margin-bottom: 26px; }
.login-card form { text-align: right; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 8px; }

.stat-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.stat-cards .card { text-align: center; }
.stat-cards .num { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; color: var(--ink); }
.stat-cards .label { font-size: .8rem; color: var(--slate); margin-top: 6px; }

.steps-editor { display: flex; flex-direction: column; gap: 10px; }
.step-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
}
.step-row .handle { color: var(--slate); cursor: grab; }
.step-row input[type=text] { flex: 1; }
.step-row select { width: 150px; }

@media (max-width: 900px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; }
  .form-grid, .stat-cards, .meta-grid { grid-template-columns: 1fr 1fr; }
}
