@font-face { font-family: Tajawal; src: url("fonts/Tajawal-Regular.ttf"); font-weight: 400; }
@font-face { font-family: Tajawal; src: url("fonts/Tajawal-Medium.ttf"); font-weight: 500; }
@font-face { font-family: Tajawal; src: url("fonts/Tajawal-Bold.ttf"); font-weight: 700; }
@font-face { font-family: Tajawal; src: url("fonts/Tajawal-ExtraBold.ttf"); font-weight: 800; }

:root {
  --green: #0f8a5b;
  --deep: #0a6b46;
  --pale: #e8f7ef;
  --canvas: #f5f7f6;
  --ink: #263238;
  --muted: #718078;
  --line: #e1eae4;
  --amber: #a96817;
  --amber-pale: #fbf1e3;
  --red: #b94e48;
  --red-pale: #f8e8e7;
  --white: #fff;
  --side: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Tajawal, sans-serif; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }

.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(34, 197, 94, .18), transparent 40%),
    var(--canvas);
}
.login-card, .card, .table-wrap, .modal {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.login-card { width: min(420px, 100%); padding: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; }
.brand img { width: 42px; height: 42px; background: linear-gradient(135deg, #14a56c, #0a6b46); border-radius: 12px; padding: 7px; }
.muted { color: var(--muted); }
h1, h2, h3 { margin: 0 0 8px; }
label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 13px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
}
textarea { min-height: 90px; resize: vertical; }
.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--green);
  color: white;
  font-weight: 700;
}
.btn.ghost { background: var(--pale); color: var(--deep); }
.btn.warn { background: var(--amber-pale); color: var(--amber); }
.btn.danger { background: var(--red-pale); color: var(--red); }
.btn.full { width: 100%; margin-top: 16px; }
.err { color: var(--red); min-height: 1.2em; font-size: 13px; }

.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100%; }
.side {
  background: var(--deep);
  color: white;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side nav { display: flex; flex-direction: column; gap: 4px; margin-top: 22px; }
.side button {
  text-align: right;
  background: transparent;
  color: rgba(255,255,255,.82);
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
}
.side button.active, .side button:hover { background: rgba(255,255,255,.12); color: white; }
.main { padding: 22px; }
.top { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.stat b { display: block; font-size: 28px; margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; }
.card { padding: 16px; margin-bottom: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: right; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-weight: 500; }
.pill { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; background: var(--pale); color: var(--green); }
.pill.wait { background: var(--amber-pale); color: var(--amber); }
.pill.bad { background: var(--red-pale); color: var(--red); }
.menu-btn { display: none; }
.modal-back {
  position: fixed; inset: 0; background: rgba(38, 50, 56, .45);
  display: grid; place-items: center; padding: 16px; z-index: 20;
}
.modal { width: min(640px, 100%); padding: 18px; max-height: 90vh; overflow: auto; }
.hidden { display: none !important; }

@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 10; transform: translateX(110%); width: min(280px, 86vw); transition: .2s ease; }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px; }
}
