@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=Literata:opsz,wght@7..72,500;7..72,700&display=swap");

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #f3f6f4;
  --bg-glow: #e4eef0;
  --surface: #ffffff;
  --surface-soft: #f7faf8;
  --ink: #1a2e2a;
  --muted: #5f736c;
  --line: #d5e0db;
  --accent: #0f7a6c;
  --accent-2: #1b9a88;
  --accent-soft: #d8f0eb;
  --warn: #b86a1c;
  --warn-soft: #fff1dd;
  --danger: #c23b3b;
  --danger-soft: #fde8e8;
  --ok: #1f7a45;
  --ok-soft: #e5f6ec;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(26, 46, 42, 0.07);
  --shadow-sm: 0 2px 10px rgba(26, 46, 42, 0.05);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --display: "Literata", "IBM Plex Sans Arabic", serif;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 100% -10%, var(--bg-glow), transparent 55%),
    radial-gradient(900px 420px at -10% 110%, #eaf3ee, transparent 50%),
    linear-gradient(180deg, #f7faf8 0%, var(--bg) 45%, #eef3f1 100%);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.4rem 1.1rem 1.5rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,250,248,0.92));
  border-left: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.6);
  overflow-y: auto;
}

.brand {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  margin: 0.2rem 0.4rem 0.35rem;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin: 0 0.4rem 1.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.sahl-sync-side {
  margin: 0 0.4rem 1.1rem;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  width: fit-content;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.78rem 0.95rem;
  border-radius: 14px;
  color: var(--ink);
  font-weight: 500;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav a:hover {
  background: var(--surface-soft);
  color: var(--accent);
  transform: translateX(-2px);
}

.nav a.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 122, 108, 0.25);
}

.nav .nav-foot {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
}

.main {
  padding: 1.6rem 1.8rem 3rem;
  max-width: 1280px;
}

.main > h1,
.page-title {
  font-family: var(--display);
  font-size: clamp(1.55rem, 2vw, 2rem);
  font-weight: 700;
  margin: 0 0 0.45rem;
  letter-spacing: -0.02em;
}

.hint {
  color: var(--muted);
  margin: 0 0 1.25rem;
  line-height: 1.7;
  max-width: 70ch;
}

.panel,
.auth-card,
.filters.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.1rem;
}

.panel h3 {
  font-family: var(--display);
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
}

.cards,
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin: 0 0 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow-sm);
}

.card .label {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.card .value {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
}

.card.warning { background: var(--warn-soft); border-color: #f0d4a8; }
.card.danger { background: var(--danger-soft); border-color: #f3c4c4; }
.card.success { background: var(--ok-soft); border-color: #bfe5cc; }

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.55rem 1.05rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-soft);
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 122, 108, 0.22);
}
.btn.ghost {
  background: transparent;
  border-color: var(--line);
}
.btn.danger {
  background: var(--danger);
  color: #fff;
}

label {
  display: block;
  margin: 0.55rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.92rem;
}

input, select, textarea {
  width: 100%;
  margin-top: 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(15, 122, 108, 0.25);
  border-color: var(--accent);
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  background: var(--surface-soft);
  position: sticky;
  top: 0;
}

.data-table.compact th,
.data-table.compact td {
  padding: 0.5rem 0.45rem;
  font-size: 0.86rem;
}

.data-table tbody tr:hover {
  background: rgba(216, 240, 235, 0.35);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.flash {
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 0.9rem;
  border: 1px solid var(--line);
  background: var(--surface);
}

.flash.success { background: var(--ok-soft); border-color: #bfe5cc; color: var(--ok); }
.flash.danger, .flash.error { background: var(--danger-soft); border-color: #f3c4c4; color: var(--danger); }
.flash.warning { background: var(--warn-soft); border-color: #f0d4a8; color: var(--warn); }

.muted { color: var(--muted); }
.mt { margin-top: 0.85rem; }
.mb { margin-bottom: 0.85rem; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.tabs a {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
}

.tabs a.active,
.tabs a:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
}

.filters label { margin: 0; min-width: 140px; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(800px 400px at 80% 10%, #d8f0eb, transparent 60%),
    radial-gradient(700px 380px at 10% 90%, #e4eef0, transparent 55%),
    #f5f8f6;
}

.auth-card {
  width: min(420px, 100%);
  padding: 1.8rem 1.6rem 1.5rem;
  animation: rise 0.45s ease both;
}

.auth-card h1 {
  font-family: var(--display);
  margin: 0 0 0.35rem;
  font-size: 1.7rem;
}

.auth-card .muted { margin-bottom: 1.2rem; }
.auth-card .btn { width: 100%; margin-top: 0.5rem; }

details.panel > summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

details.panel > summary::-webkit-details-marker { display: none; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.main > *,
.panel,
.card {
  animation: rise 0.35s ease both;
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    height: auto;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }
  .main { padding: 1.1rem 1rem 2.5rem; }
}
