﻿:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1f2a37;
  --muted: #6b7280;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --danger: #b91c1c;
  --warning: #b45309;
  --border: #dbe2ea;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Tajawal", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #e6fff8, var(--bg) 35%);
  color: var(--text);
}

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 280px;
  background: linear-gradient(165deg, #0f766e, #134e4a);
  color: #fff;
  padding: 1rem;
  position: fixed;
  inset: 0 auto 0 0;
  transform: translateX(0);
  transition: transform .25s ease;
  z-index: 40;
}

.brand { font-size: 1.35rem; font-weight: 700; margin-bottom: .5rem; }
.admin-info { font-size: .95rem; opacity: .95; margin-bottom: 1rem; }
nav { display: grid; gap: .45rem; margin-bottom: 1rem; }

.nav-link {
  text-decoration: none;
  color: #e6fffb;
  padding: .6rem .75rem;
  border-radius: .6rem;
  background: rgba(255,255,255,.08);
}

.nav-link.active,
.nav-link:hover { background: rgba(255,255,255,.18); }

.main {
  margin-inline-start: 280px;
  width: calc(100% - 280px);
  padding: 1rem;
}

.topbar { display: flex; align-items: center; gap: .8rem; margin-bottom: 1rem; }
.topbar h1 { margin: 0; font-size: 1.2rem; }
.menu-btn { display: none; border: 0; background: var(--brand); color: #fff; border-radius: .5rem; padding: .45rem .7rem; }

.grid { display: grid; gap: .8rem; }
.two-col { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.three-col { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.cards-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: .9rem;
  padding: 1rem;
  box-shadow: 0 8px 26px rgba(17, 24, 39, .06);
  margin-bottom: 1rem;
}

.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.stat-card p { font-size: 1.6rem; font-weight: 700; margin: .4rem 0 0; }

label { display: grid; gap: .35rem; font-weight: 600; color: #374151; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: .6rem;
  padding: .58rem .65rem;
  font: inherit;
  background: #fff;
}

textarea { resize: vertical; }

.checkbox-row { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.checkbox-row input { width: auto; }

.btn {
  border: 0;
  border-radius: .65rem;
  padding: .6rem .95rem;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
  font-weight: 700;
}

.btn.secondary { background: #2563eb; }
.btn.danger { background: var(--danger); }
.btn.full { width: 100%; }

.actions-row { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .7rem; }

.badge {
  display: inline-block;
  border-radius: 999px;
  font-size: .78rem;
  padding: .25rem .55rem;
  color: #fff;
}

.badge.success { background: #047857; }
.badge.danger { background: #b91c1c; }
.badge.warning { background: var(--warning); }

.inline-form { display: flex; gap: .55rem; flex-wrap: wrap; }
.inline-form input { min-width: 220px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--border); padding: .55rem; text-align: right; vertical-align: top; }
.log-payload { max-width: 520px; word-break: break-word; font-size: .83rem; }

.flash-stack { display: grid; gap: .45rem; margin-bottom: .8rem; }
.flash { padding: .65rem .85rem; border-radius: .6rem; color: #fff; }
.flash.success { background: #047857; }
.flash.error { background: #b91c1c; }
.flash.info { background: #1d4ed8; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 80;
}

.modal.show { display: flex; }
.modal-content { background: #fff; width: min(420px, 100%); border-radius: .9rem; padding: 1rem; }

.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--border); border-radius: .9rem; padding: 1rem; box-shadow: 0 16px 40px rgba(2, 6, 23, .12); }
.hint { color: var(--muted); font-size: .9rem; }

@media (max-width: 920px) {
  .menu-btn { display: inline-flex; }
  .sidebar {
    transform: translateX(-105%);
    width: 86%;
    max-width: 330px;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-inline-start: 0; width: 100%; }
}
