:root {
  --brand: #111827;
  --brand-2: #b8893b;          /* gold accent */
  --brand-soft: #f6efe1;
  --bg: #f3f4f8;
  --sidebar-w: 260px;
  --radius: 16px;
  --shadow: 0 10px 30px -12px rgba(17, 24, 39, .18);
}
* { -webkit-font-smoothing: antialiased; }
body { background: var(--bg); font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, -apple-system, Arial, sans-serif; color: #1f2937; }
.btn-brand { background: linear-gradient(135deg, #1f2937, #111827); color: #fff; border: 0; box-shadow: 0 6px 16px -6px rgba(17, 24, 39, .6); }
.btn-brand:hover, .btn-brand:focus { background: linear-gradient(135deg, var(--brand-2), #8f6a27); color: #fff; }
.form-control:focus, .form-select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 .2rem rgba(184, 137, 59, .2); }

/* ---------- layout ---------- */
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w); z-index: 1040;
  background: linear-gradient(180deg, #111827 0%, #1f2937 100%); color: #cbd5e1; display: flex; flex-direction: column; padding: 1.25rem 1rem; transition: transform .25s; }
.sidebar .brand { display: block; text-align: center; text-decoration: none; margin-bottom: 1.5rem; }
.brand-logo { display: block; background: #fff; border-radius: 14px; padding: .6rem 1rem; box-shadow: 0 8px 20px -8px #000; }
.brand-logo img { max-width: 100%; height: 54px; object-fit: contain; }
.sidebar .brand small { display: block; color: #94a3b8; margin-top: .6rem; letter-spacing: .08em; text-transform: uppercase; font-size: .68rem; }
.sidebar .nav-link { color: #cbd5e1; border-radius: 12px; padding: .7rem 1rem; display: flex; align-items: center; gap: .8rem; margin-bottom: .25rem; font-weight: 500; }
.sidebar .nav-link i { font-size: 1.15rem; }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar .nav-link.active { background: linear-gradient(135deg, var(--brand-2), #8f6a27); color: #fff; box-shadow: 0 8px 18px -8px rgba(184, 137, 59, .9); }
.sidebar-foot { margin-top: auto; }
.main { margin-inline-start: var(--sidebar-w); min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: 1rem 2rem; background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 1030; border-bottom: 1px solid #e5e7eb; }
.page-title { font-size: 1.35rem; font-weight: 700; margin: 0; }
.user-chip { background: #fff; border: 1px solid #e5e7eb; border-radius: 999px; padding: .35rem .9rem; display: flex; align-items: center; gap: .5rem; }
.content { padding: 1.75rem 2rem 3rem; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .is-rtl .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: none !important; }
  .main { margin-inline-start: 0; }
  .topbar, .content { padding-inline: 1rem; }
}

/* ---------- cards ---------- */
.card-soft { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-soft .table { --bs-table-bg: transparent; }
.card-soft thead th { background: #f9fafb; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; border-bottom: 1px solid #e5e7eb; white-space: nowrap; }
.card-soft tbody td { padding-block: .8rem; }
.table-total td { background: var(--brand-soft) !important; font-weight: 700; border-top: 2px solid var(--brand-2); }
.row-inactive td { opacity: .6; }
.avatar { display: inline-flex; width: 34px; height: 34px; border-radius: 50%; align-items: center; justify-content: center; background: var(--brand-soft); color: #8f6a27; font-weight: 700; margin-inline-end: .5rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.6rem; }

/* ---------- dashboard ---------- */
.welcome { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.welcome h2 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.kpi { display: flex; align-items: center; gap: 1rem; padding: 1.25rem; border-radius: var(--radius); color: #fff; box-shadow: var(--shadow); height: 100%; }
.kpi-icon { width: 54px; height: 54px; border-radius: 14px; background: rgba(255, 255, 255, .2); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; flex: none; }
.kpi-label { font-size: .8rem; opacity: .85; }
.kpi-value { font-size: 1.3rem; font-weight: 700; }
.kpi-a { background: linear-gradient(135deg, #1f2937, #374151); }
.kpi-b { background: linear-gradient(135deg, #b8893b, #8f6a27); }
.kpi-c { background: linear-gradient(135deg, #be123c, #9f1239); }
.kpi-d { background: linear-gradient(135deg, #059669, #047857); }
.bar-row { display: grid; grid-template-columns: 110px 1fr 90px; gap: .75rem; align-items: center; margin-bottom: .7rem; }
.bar-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: #eef0f4; border-radius: 999px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #b8893b, #1f2937); }
.bar-val { text-align: end; font-variant-numeric: tabular-nums; font-size: .9rem; }
.activity li { display: flex; gap: .75rem; padding: .55rem 0; border-bottom: 1px dashed #e5e7eb; }
.activity .dot { width: 10px; height: 10px; margin-top: .4rem; border-radius: 50%; background: var(--brand-2); flex: none; }

/* ---------- month nav ---------- */
.month-nav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.month-input { width: 170px; }
.month-title { font-weight: 700; font-size: 1.1rem; margin-inline-start: .5rem; }

/* ---------- attendance ---------- */
.att-wrap { max-height: 70vh; }
.att-table th, .att-table td { white-space: nowrap; }
.att-table .sticky-col { position: sticky; inset-inline-start: 0; background: #fff; z-index: 2; min-width: 150px; box-shadow: 2px 0 4px -2px rgba(0, 0, 0, .1); }
.att-table thead .sticky-col { background: #f9fafb; }
.day-h { min-width: 34px; padding: .3rem .1rem !important; line-height: 1.1; }
.day-h small { font-weight: 400; opacity: .7; }
.day-h.today { color: var(--brand-2); }
.day-h.wknd { color: #9ca3af; }
.day-cell { display: inline-block; width: 30px; height: 30px; border-radius: 8px; border: 0; font-weight: 700; font-size: .8rem; cursor: pointer; margin: 2px; transition: transform .1s; }
.legend .day-cell { cursor: default; width: 26px; height: 26px; line-height: 26px; padding: 0; }
button.day-cell:hover { transform: scale(1.12); }
.st-P { background: #d1fae5; color: #047857; }
.st-A { background: #fee2e2; color: #b91c1c; }
.st-R { background: #e0e7ff; color: #4338ca; }
.day-cell.changed { outline: 2px solid var(--brand-2); }

/* ---------- misc ---------- */
.net-preview { background: var(--brand-soft); border-radius: 10px; padding: .6rem .9rem; }
.payroll-table td, .payroll-table th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.text-bg-success-subtle { background: #d1fae5; color: #047857; }
.text-bg-danger-subtle { background: #fee2e2; color: #b91c1c; }

/* ---------- auth ---------- */
.auth-body { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, #2b3648 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #7a5a22 0, transparent 55%), #111827; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 440px; background: #fff; border-radius: 22px; padding: 2.25rem 2rem; box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .6); }
.auth-logo { text-align: center; margin-bottom: 1rem; }
.auth-logo img { height: 80px; max-width: 100%; object-fit: contain; }
.auth-title { text-align: center; font-weight: 700; font-size: 1.4rem; margin-bottom: .25rem; }

/* ---------- print (payroll, payslip, lists) ---------- */
.print-head, .print-foot, .signatures { display: none; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff !important; }
  .sidebar, .topbar, .no-print, .alert { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; }
  .card-soft { box-shadow: none !important; border: 1px solid #ddd !important; border-radius: 0 !important; }
  .card-soft thead th { background: #eee !important; color: #000 !important; }
  .table-responsive { overflow: visible !important; }
  .print-head { display: flex !important; align-items: center; gap: 1.25rem; border-bottom: 3px solid #111; padding-bottom: .75rem; margin-bottom: 1rem; }
  .print-head img { height: 70px; }
  .print-head .ph-text { flex: 1; font-size: .85rem; }
  .print-head h2 { margin: 0; font-size: 1.6rem; font-weight: 800; }
  .print-head .ph-title { text-align: end; }
  .print-head h3 { margin: 0; font-size: 1.2rem; text-transform: uppercase; }
  .print-foot { display: block !important; margin-top: 1rem; font-size: .75rem; color: #555; }
  .signatures { display: flex !important; justify-content: space-around; margin-top: 3rem; }
  .signatures div { border-top: 1px solid #000; padding-top: .4rem; min-width: 220px; text-align: center; }
  .table-total td { background: #f1e6cc !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- seller calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { margin-bottom: 6px; text-align: center; font-size: .75rem; font-weight: 700; text-transform: uppercase; color: #6b7280; letter-spacing: .04em; }
.cal-day { position: relative; display: flex; flex-direction: column; min-height: 84px; padding: 6px 8px; border-radius: 12px; border: 2px solid transparent; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s; }
.cal-day.empty { background: transparent; }
.cal-day.off { background: #f3f4f6; color: #9ca3af; }
a.cal-day:hover { transform: translateY(-2px); box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .35); color: inherit; }
.cal-day.selected { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(184, 137, 59, .25); }
.cal-day.is-today .cal-num { background: var(--brand); color: #fff; border-radius: 50%; min-width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; align-self: flex-start; }
.cal-num { font-weight: 700; font-size: .95rem; }
.cal-st { position: absolute; top: 6px; inset-inline-end: 8px; font-weight: 800; font-size: .8rem; opacity: .7; }
.cal-chips { margin-top: auto; display: flex; flex-wrap: wrap; gap: 3px; }
.chip { font-size: .68rem; border-radius: 999px; padding: 1px 7px; font-weight: 600; white-space: nowrap; }
.chip-adv { background: #fef3c7; color: #92400e; }
.chip-art { background: #fce7f3; color: #9d174d; }
.day-panel { position: sticky; top: 90px; }
.status-btn { display: flex; flex-direction: column; align-items: center; border: 2px solid transparent; padding: .5rem .25rem; font-weight: 800; }
.status-btn .sb-letter { display: block; font-size: 1.1rem; line-height: 1.1; }
.status-btn .sb-label { display: block; font-weight: 500; font-size: .7rem; }
.status-btn.active { border-color: currentColor; box-shadow: 0 6px 14px -8px currentColor; }
.entry { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px dashed #e5e7eb; }
@media (max-width: 575.98px) { .cal-day { min-height: 62px; padding: 4px; } .chip { font-size: .6rem; padding: 0 4px; } }
@media print { .day-panel { position: static; } }
