:root {
  --bg: #ffffff;
  --bg-soft: #f5f9ff;
  --bg-panel: #ffffff;
  --ink: #0f2744;
  --muted: #5a6f8a;
  --blue: #1e8fff;
  --blue-deep: #0b66d6;
  --blue-soft: #e8f3ff;
  --sun: #f5b400;
  --sun-deep: #e88900;
  --sun-soft: #fff6db;
  --danger: #d64545;
  --ok: #1f9d6a;
  --line: #d9e6f5;
  --shadow: 0 10px 30px rgba(15, 70, 140, 0.08);
  --radius: 16px;
  --font: "IBM Plex Sans Arabic", sans-serif;
  --display: "IBM Plex Sans Arabic", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(245, 180, 0, 0.12), transparent 55%),
    radial-gradient(800px 480px at -5% 0%, rgba(30, 143, 255, 0.12), transparent 50%),
    var(--bg);
}

.screen { min-height: 100vh; }
.login-shell {
  max-width: 440px;
  margin: 0 auto;
  padding: 8vh 1.25rem 3rem;
  animation: rise 0.6s ease both;
  text-align: center;
}
.login-logo {
  width: min(280px, 78vw);
  height: auto;
  display: block;
  margin: 0 auto 1rem;
  filter: drop-shadow(0 10px 24px rgba(11, 102, 214, 0.18));
}
.brand-block { margin-bottom: 1.25rem; }
.brand, .brand-sm {
  font-family: var(--display);
  color: var(--blue-deep);
  letter-spacing: 0.01em;
  margin: 0 0 0.25rem;
  font-weight: 700;
}
.brand { font-size: 1.15rem; }
.brand-sm { font-size: 0.95rem; }
.top-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.top-brand img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}
h1 {
  font-family: var(--display);
  font-size: clamp(1.55rem, 3.5vw, 2rem);
  margin: 0 0 0.45rem;
  color: var(--ink);
}
.lead { color: var(--muted); margin: 0 0 1.5rem; line-height: 1.7; }
.stack { display: grid; gap: 0.85rem; text-align: right; }
label { display: grid; gap: 0.35rem; font-size: 0.92rem; color: var(--muted); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  box-shadow: inset 0 1px 2px rgba(15, 70, 140, 0.03);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(30, 143, 255, 0.25);
  border-color: var(--blue);
}
textarea { min-height: 80px; resize: vertical; }
.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.15rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s, box-shadow 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  color: #fff;
  box-shadow: 0 8px 18px rgba(11, 102, 214, 0.25);
}
.btn.ok { background: var(--ok); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost {
  background: #fff;
  color: var(--blue-deep);
  border: 1px solid var(--line);
}
.error { color: var(--danger); margin: 0; }
.topbar {
  display: flex; align-items: center; gap: 1rem; justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 18px rgba(15, 70, 140, 0.05);
}
.nav { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.nav button {
  background: transparent; color: var(--muted); border: 0; border-radius: 999px;
  padding: 0.45rem 0.85rem; font: inherit; cursor: pointer;
}
.nav button.active {
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-weight: 600;
}
.main { padding: 1.25rem; max-width: 1100px; margin: 0 auto; animation: rise 0.35s ease both; }
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.panel h2 {
  font-family: var(--display);
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
  color: var(--blue-deep);
}
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
table { width: 100%; border-collapse: collapse; min-width: 1100px; }
th, td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 0.92rem;
}
th {
  color: var(--blue-deep);
  font-weight: 600;
  background: var(--bg-soft);
  position: sticky;
  top: 0;
}
tr:hover td { background: #f8fbff; }
.qty { width: 5.5rem; }
.badge {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.78rem; background: var(--bg-soft); color: var(--ink);
}
.badge.pending { background: var(--sun-soft); color: #9a6400; }
.badge.confirmed { background: #e5f8ef; color: #147a52; }
.badge.rejected { background: #fdecec; color: #b42318; }
.row-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.85rem; }
.muted { color: var(--muted); }
.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  padding: 0.75rem 1.1rem;
  border-radius: 999px; box-shadow: var(--shadow); z-index: 20;
  animation: rise 0.25s ease both;
}
.toast.bad { border-color: rgba(214, 69, 69, 0.45); color: var(--danger); }
.stat {
  font-size: 1.6rem; font-family: var(--display); color: var(--blue-deep); margin: 0;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.filters-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: end;
  margin-top: 1rem;
}
.filters-bar .filter-company {
  min-width: 220px;
  flex: 0 1 280px;
}
.filters-bar #filter {
  flex: 1;
  min-width: 180px;
}
.finance-box {
  margin: 0.85rem 0 0.35rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--bg-soft), #fff);
}
.finance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem 1rem;
}
.finance-grid div {
  display: grid;
  gap: 0.2rem;
}
.finance-grid strong {
  font-size: 1.05rem;
  color: var(--ink);
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 39, 68, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal[hidden] { display: none !important; }
.modal-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  text-align: right;
}
.modal-card h2 {
  margin: 0 0 0.5rem;
  color: var(--blue-deep);
  font-family: var(--display);
  font-size: 1.2rem;
}
.bulk-result {
  max-height: 360px;
  overflow: auto;
  margin-top: 0.75rem;
  font-size: 0.88rem;
}
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; }
  table { min-width: 520px; }
  .top-brand img { width: 48px; height: 48px; }
}
