:root {
  --bg-0: #e8eef4;
  --bg-1: #f4f7fa;
  --ink: #132033;
  --ink-soft: #5a6b7d;
  --line: rgba(19, 32, 51, 0.1);
  --panel: rgba(255, 255, 255, 0.92);
  --brand: #0b3d4a;
  --brand-2: #146677;
  --accent: #c9892d;
  --accent-soft: rgba(201, 137, 45, 0.14);
  --ok: #1f7a4d;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(11, 61, 74, 0.08);
  --radius: 16px;
  --font: "Cairo", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(20, 102, 119, 0.18), transparent 55%),
    radial-gradient(900px 420px at -10% 100%, rgba(201, 137, 45, 0.16), transparent 50%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(19, 32, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 32, 51, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  z-index: 0;
}

.app-shell,
.app-nav,
.page-wrap {
  position: relative;
  z-index: 1;
}

.app-nav {
  background: linear-gradient(120deg, #0b3d4a 0%, #134e5e 55%, #0f2f3a 100%);
  box-shadow: 0 8px 24px rgba(11, 61, 74, 0.25);
  padding: 0.35rem 0;
}

.app-nav .navbar-brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.25rem;
}

.app-nav .nav-link {
  color: rgba(255, 255, 255, 0.82) !important;
  font-weight: 600;
  padding: 0.55rem 0.9rem !important;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.app-nav .nav-link:hover,
.app-nav .nav-link.active {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.page-wrap {
  padding-top: 1.75rem;
  padding-bottom: 2.5rem;
  animation: riseIn 0.45s ease both;
}

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

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}

.page-head h1,
.page-head h2 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--brand);
}

.page-head p {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.panel-body { padding: 1.25rem; }
.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  color: var(--brand);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 992px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 576px) {
  .stat-grid { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--brand-2), var(--accent));
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(11, 61, 74, 0.12);
}

.stat-card span {
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
}

.stat-card strong {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.filters-panel {
  margin-bottom: 1.1rem;
  padding: 1.15rem;
}

.filters-panel .form-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}

.form-control,
.form-select {
  border-radius: 12px;
  border-color: rgba(19, 32, 51, 0.14);
  padding: 0.65rem 0.85rem;
  background: #fff;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 0.2rem rgba(20, 102, 119, 0.15);
}

.btn {
  border-radius: 12px;
  font-weight: 700;
  padding: 0.55rem 1rem;
}

.btn-primary {
  --bs-btn-bg: var(--brand-2);
  --bs-btn-border-color: var(--brand-2);
  --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand);
  --bs-btn-active-border-color: var(--brand);
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1308;
}

.btn-accent:hover {
  background: #b6791f;
  border-color: #b6791f;
  color: #1a1308;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-ghost:hover {
  background: rgba(11, 61, 74, 0.06);
  border-color: rgba(11, 61, 74, 0.18);
  color: var(--ink);
}

.data-table {
  margin: 0;
}

.data-table thead th {
  background: rgba(11, 61, 74, 0.05);
  color: var(--brand);
  font-weight: 800;
  font-size: 0.86rem;
  white-space: nowrap;
  border-bottom-width: 1px;
  padding: 0.9rem 0.85rem;
}

.data-table tbody td {
  padding: 0.9rem 0.85rem;
  vertical-align: middle;
  border-color: rgba(19, 32, 51, 0.06);
}

.data-table tbody tr {
  transition: background 0.2s ease;
}

.data-table tbody tr:hover {
  background: rgba(20, 102, 119, 0.04);
}

.project-title {
  font-weight: 700;
  color: var(--ink);
  max-width: 320px;
}

.badge-stage {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
}

.actions-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.actions-group .btn {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}

.login-wrap {
  min-height: calc(100vh - 2rem);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(440px, 100%);
  padding: 2rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: riseIn 0.5s ease both;
}

.login-card h1 {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--brand);
  margin-bottom: 0.25rem;
}

.login-card .lead {
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 768px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.detail-item {
  background: rgba(11, 61, 74, 0.04);
  border-radius: 14px;
  padding: 1rem;
}

.detail-item label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}

.detail-item strong {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.chart-box {
  position: relative;
  min-height: 280px;
  padding: 0.5rem;
}

.report-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.report-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.report-list li:last-child { border-bottom: 0; }

.report-list .meta {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--ink-soft);
}

.alert {
  border: 0;
  border-radius: 14px;
  font-weight: 600;
}

.section-title {
  font-weight: 800;
  color: var(--brand);
  margin-bottom: 1rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent-soft);
  color: #6a4a12;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.results-meta {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
