:root {
  --ink: #16242b;
  --muted: #6b7a82;
  --line: #e3e8ea;
  --bg: #f4f6f5;
  --card: #ffffff;
  --brand: #1f4e5f;
  --brand-2: #2b6b80;
  --save: #12805c;
  --save-bg: #e6f4ee;
  --up: #c0392b;
  --up-bg: #fbecea;
  --warn: #b7791f;
  --side: #13303a;
}
* { font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif; }
body { background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { color: var(--brand); text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 248px; background: var(--side); color: #c9d6db; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 10px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 6px 8px 16px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 8px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #3aa17e, #2b6b80); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.brand-name { color: #fff; font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 11px; color: #8fa9b3; }
.sidebar .nav-link { color: #c9d6db; border-radius: 8px; padding: 7px 10px; display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
.sidebar .nav-link i { font-size: 15px; opacity: .85; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar .nav-link.active { background: rgba(58,161,126,.18); color: #fff; box-shadow: inset 3px 0 0 #3aa17e; }
[dir=rtl] .sidebar .nav-link.active { box-shadow: inset -3px 0 0 #3aa17e; }
.nav-sec { font-size: 11px; color: #6f8d98; text-transform: uppercase; letter-spacing: .04em; padding: 14px 10px 4px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 22px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 20; }
.topbar-title { font-weight: 600; font-size: 16px; }
.content { padding: 20px 22px 40px; }

.card { border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(16,36,43,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 600; padding: 12px 16px; }
.page-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h1 { font-size: 20px; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; }

.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; height: 100%; }
.kpi .lbl { color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.kpi .val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.hero { background: linear-gradient(135deg, #12805c, #1f4e5f); color: #fff; border: 0; }
.kpi.hero .lbl, .kpi.hero .hint { color: rgba(255,255,255,.8); }
.kpi.hero .val { font-size: 28px; }

.table { margin-bottom: 0; font-size: 13.5px; }
.table > :not(caption) > * > * { padding: .55rem .6rem; vertical-align: middle; }
.table thead th { background: #f0f3f4; color: #46575f; font-weight: 600; font-size: 12.5px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table-hover tbody tr:hover { background: #f7faf9; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: end; }
.text-success { color: var(--save) !important; }
.text-danger { color: var(--up) !important; }
.save-pill { background: var(--save-bg); color: var(--save); border-radius: 20px; padding: 2px 10px; font-weight: 600; font-size: 12.5px; white-space: nowrap; display: inline-block; }
.up-pill { background: var(--up-bg); color: var(--up); border-radius: 20px; padding: 2px 10px; font-weight: 600; font-size: 12.5px; white-space: nowrap; display: inline-block; }
.badge { font-weight: 500; }
.st-new { background: #e7eef7; color: #2c5d9b; }
.st-quoting { background: #fff4e0; color: #9a6400; }
.st-awarded { background: #efe9fb; color: #5b3fa3; }
.st-approved, .st-active, .st-paid { background: var(--save-bg); color: var(--save); }
.st-rejected, .st-cancelled, .st-expired, .st-overdue { background: var(--up-bg); color: var(--up); }
.st-expiring, .st-partial, .st-due { background: #fff4e0; color: #9a6400; }
.st-upcoming, .st-unpaid { background: #eef1f2; color: #46575f; }

.filters { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 14px; }
.filters .form-control, .filters .form-select { font-size: 13px; }
.form-label { font-size: 12.5px; color: #46575f; margin-bottom: 3px; font-weight: 500; }
.form-control, .form-select { font-size: 13.5px; }
.req::after { content: " *"; color: var(--up); }

.saving-breakdown { display: grid; gap: 8px; }
.sb-row { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 8px; background: #f6f8f8; }
.sb-row.total { background: var(--save-bg); font-weight: 700; color: var(--save); }
.sb-row.neg { background: var(--up-bg); color: var(--up); }

.item-info { font-size: 12px; margin-top: 4px; line-height: 1.6; }
.item-info .chip { display: inline-block; background: #f0f3f4; border-radius: 6px; padding: 1px 7px; margin: 1px 2px; white-space: nowrap; }
.line-row td { vertical-align: top !important; }
.best-cell { background: var(--save-bg) !important; font-weight: 700; color: var(--save); }
.awarded-col { outline: 2px solid #3aa17e; outline-offset: -2px; }
.src-proc { background: #e6f0f4; color: var(--brand); }
.src-branch { background: #f1eee6; color: #7a5b17; }

.alert-list .a-item { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.alert-list .a-item:last-child { border-bottom: 0; }
.a-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.a-danger { background: var(--up); } .a-warning { background: #e0a020; } .a-info { background: #2b6b80; }

.bar { height: 8px; background: #edf1f2; border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #3aa17e, #2b6b80); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 20% 20%, #1f4e5f, #13303a); padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 30px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.ts-wrapper.form-select, .ts-wrapper.form-control { padding: 0; }
.ts-control { font-size: 13.5px; min-height: 34px; }
.small-muted { font-size: 12px; color: var(--muted); }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 18px; }
.dl-grid dt { font-weight: 500; color: var(--muted); font-size: 12px; }
.dl-grid dd { margin: 0; font-weight: 500; }

@media (max-width: 991px) {
  .sidebar { position: fixed; z-index: 50; inset-inline-start: -260px; transition: .2s; }
  .sidebar.open { inset-inline-start: 0; }
  .content { padding: 14px; }
}
@media print {
  .sidebar, .topbar, .filters, .no-print, .btn { display: none !important; }
  .content { padding: 0; }
  .card { break-inside: avoid; }
  body { background: #fff; }
}

/* ألوان الأزرار الأساسية */
.btn-primary { --bs-btn-bg: #1f4e5f; --bs-btn-border-color: #1f4e5f; --bs-btn-hover-bg: #2b6b80; --bs-btn-hover-border-color: #2b6b80; --bs-btn-active-bg: #183e4b; }
.btn-success { --bs-btn-bg: #12805c; --bs-btn-border-color: #12805c; --bs-btn-hover-bg: #0f6c4e; }
.nav-tabs .nav-link { color: var(--muted); }
.nav-tabs .nav-link.active { color: var(--ink); font-weight: 600; }
