:root {
  --navy: #0D2B45;
  --blue: #087EE5;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --text: #0F172A;
  --muted: #64748B;
  --line: #E2E8F0;
  --success: #22C55E;
  --danger: #EF4444;
  --warning: #F59E0B;
  --shadow: 0 10px 25px rgba(2, 8, 23, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: "Tajawal", system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  background: linear-gradient(180deg, #EEF5FF 0%, var(--bg) 30%, var(--bg) 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 247, 250, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  max-width: 1200px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  box-shadow: var(--shadow);
  position: relative;
}

.logo:after {
  content: "";
  position: absolute;
  inset: 10px 14px 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px 999px 999px 999px;
  clip-path: polygon(50% 0%, 72% 22%, 86% 45%, 84% 66%, 68% 84%, 50% 100%, 32% 84%, 16% 66%, 14% 45%, 28% 22%);
  opacity: 0.95;
}

.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}

.brand p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}



.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  min-width: 320px;
  box-shadow: 0 6px 18px rgba(2, 8, 23, 0.04);
}

.search svg {
  opacity: .65
}

.search input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 14px;
  background: transparent;
  font-family: inherit;
}

.chip {
  font-size: 12px;
  color: var(--navy);
  background: rgba(8, 126, 229, 0.12);
  border: 1px solid rgba(8, 126, 229, 0.22);
  padding: 7px 10px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  margin-top: 16px;
}

/* Sidebar */
.sidebar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  height: calc(100vh - 110px);
  position: sticky;
  top: 86px;
  overflow: auto;
}

.userbox {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(13, 43, 69, .08), rgba(8, 126, 229, .08));
  border: 1px solid rgba(8, 126, 229, .15);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(13, 43, 69, .12);
  display: grid;
  place-items: center;
  font-weight: 900;
  color: var(--navy);
}

.userbox .name {
  font-weight: 800
}

.userbox .role {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px
}

.nav {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
}

.nav a:hover {
  background: rgba(8, 126, 229, 0.08);
  border-color: rgba(8, 126, 229, 0.14);
}

.nav a.active {
  background: linear-gradient(135deg, rgba(13, 43, 69, .10), rgba(8, 126, 229, .12));
  border-color: rgba(8, 126, 229, .22);
  color: var(--navy);
}

.nav small {
  display: block;
  font-weight: 600;
  color: var(--muted);
  margin-top: -2px;
  font-size: 12px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}

/* Content */
.content {
  min-height: calc(100vh - 110px);
}

.hero {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  border-radius: var(--radius);
  color: #fff;
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, .18);
  position: relative;
  overflow: hidden;
}

.hero:after {
  content: "";
  position: absolute;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  left: -120px;
  top: -160px;
  filter: blur(0px);
}

.hero .row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.hero h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 900
}

.hero p {
  margin: 6px 0 0;
  opacity: .9;
  font-weight: 500
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: .15s ease;
  white-space: nowrap;
}

.btn.primary {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.10);
}

.btn.primary:hover {
  transform: translateY(-1px)
}

.btn.ghost {
  background: rgba(255, 255, 255, .15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .28);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, .20)
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  margin-top: 16px;
}

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

.card h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 900;
  color: var(--navy);
}

.kpi {
  display: flex;
  gap: 12px;
  align-items: center;
}

.kpi .icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(8, 126, 229, 0.10);
  border: 1px solid rgba(8, 126, 229, 0.18);
}

.kpi .num {
  font-weight: 900;
  font-size: 20px
}

.kpi .lbl {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  margin-top: 2px
}

.span-4 {
  grid-column: span 4
}

.span-6 {
  grid-column: span 6
}

.span-8 {
  grid-column: span 8
}

.span-12 {
  grid-column: span 12
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
}

th,
td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  text-align: right;
  vertical-align: middle;
}

th {
  background: rgba(13, 43, 69, 0.06);
  color: var(--navy);
  font-weight: 900;
  font-size: 13px;
}

tr:last-child td {
  border-bottom: none
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.b-new {
  background: rgba(8, 126, 229, 0.10);
  border-color: rgba(8, 126, 229, 0.20);
  color: var(--blue);
}

.b-match {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.22);
  color: #B45309;
}

.b-done {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.22);
  color: #15803D;
}

.b-risk {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.22);
  color: #B91C1C;
}

/* Forms */
.form {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
  width: 100%;
}

.field {
  grid-column: span 6
}

.field.full {
  grid-column: span 12
}

label {
  display: block;
  font-weight: 900;
  color: var(--navy);
  font-size: 13px;
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  outline: none;
  font-family: inherit;
  background: #fff;
  font-size: 14px;
}

textarea {
  min-height: 110px;
  resize: vertical
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(8, 126, 229, 0.45);
  box-shadow: 0 0 0 4px rgba(8, 126, 229, 0.12);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btn.blue {
  background: var(--blue);
  color: #fff;
}

.btn.blue:hover {
  transform: translateY(-1px)
}

.btn.light {
  background: rgba(13, 43, 69, 0.06);
  color: var(--navy);
  border: 1px solid rgba(13, 43, 69, 0.10);
}

/* Page sections (simple routing) */
.page {
  display: none
}

.page.active {
  display: block
}

/* Footer */
.footer {
  margin: 16px 0 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  padding: 10px;
}

/* Font Awesome Icons Styling */
.fa,
.fas,
.fab,
.far,
.fal,
.fad {
  display: inline-block;
  vertical-align: -0.125em;
  color: inherit;
}

/* Button Icons */
.btn i {
  margin-right: 6px;
}

/* Nav Icons */
.nav i {
  font-size: 16px;
  opacity: 0.85;
}

/* Icon in headers and titles */
h1 i,
h2 i,
h3 i {
  margin-right: 8px;
  opacity: 0.9;
}

/* Back link styling */
.back-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: rgba(13, 43, 69, 0.05);
  color: var(--navy);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  border: 1px solid rgba(13, 43, 69, 0.1);
}
.back-link:hover {
  background: rgba(13, 43, 69, 0.1);
  color: var(--blue);
  border-color: rgba(13, 43, 69, 0.2);
}
.back-link i {
  margin-right: 6px;
  opacity: 0.85;
}

/* Badge icons */
.badge i {
  font-size: 13px;
}

/* Responsive */
@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr
  }

  .sidebar {
    position: relative;
    top: 0;
    height: auto
  }

  .search {
    min-width: 0;
    width: 100%
  }

  .topbar-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .top-actions {
    justify-content: space-between
  }

  .span-4,
  .span-6,
  .span-8 {
    grid-column: span 12
  }

  .field {
    grid-column: span 12
  }
}

/* Detail View */
.detail-card {
  padding: 24px;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 20px;
}

.detail-row {
  display: flex;
  margin-bottom: 12px;
  font-size: 16px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 12px;
}

.detail-label {
  width: 150px;
  font-weight: 800;
  color: var(--navy);
}

.detail-value {
  flex: 1;
  color: var(--text);
}

/* Print Styles */
#receipt-print {
  display: none;
}

@media print {
  body {
    background: #fff;
    margin: 0;
    padding: 0;
  }

  .sidebar, .topbar, .hero, .card, .form-actions, .back-link, .no-print {
    display: none !important;
  }

  #receipt-print {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    display: block !important;
    padding: 20px;
    background: #fff;
    direction: rtl;
  }

  .receipt-header {
    text-align: center;
    border-bottom: 2px solid #000;
    margin-bottom: 30px;
    padding-bottom: 15px;
  }

  .receipt-header h2 {
    font-size: 26px;
    margin: 0 0 10px;
    color: #000;
    font-weight: 900;
  }

  .receipt-header h3 {
    font-size: 20px;
    margin: 0;
    color: #333;
    font-weight: 700;
  }

  .receipt-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 16px;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 15px;
  }

  .receipt-details {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
  }

  .receipt-details p {
    margin: 10px 0;
    font-size: 16px;
  }

  #receipt-print h4 {
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 18px;
    color: #000;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    font-weight: 900;
  }

  .receipt-footer {
    text-align: center;
    margin-top: 50px;
    font-size: 16px;
    color: #555;
    border-top: 1px dashed #ccc;
    padding-top: 20px;
    font-weight: 700;
  }
}