/* El Masria Petroleum Services — company theme (red + black on white, Arabic first). Loaded after styles.css. */
:root {
  --brand: #c4161c; --brand-dark: #9d1015; --brand-soft: #fdeced; --brand-line: #f5c9cb;
  --ink: #1b1b1d; --ink-2: #3a3b3f; --muted: #6f7178; --line: #e7e7ea; --bg: #f5f5f6; --surface: #fff;
  --ok: #138a5a; --warn: #a35d00; --danger: #b3261e;
  --radius: 12px; --shadow: 0 1px 2px #0000000d, 0 4px 14px #0000000a;
  --font: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
  --blue: var(--brand); --blue-dark: var(--brand-dark); --navy: var(--ink);
  font-family: var(--font); color: var(--ink); background: var(--bg);
}
body { background: var(--bg); font-family: var(--font); color: var(--ink); }
button, input, select, textarea { font-family: var(--font) !important; }

/* ---------- shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  width: 268px; background: var(--surface); color: var(--ink); padding: 0; border-inline-end: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 30;
}
.brand { height: 92px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-bottom: 1px solid var(--line); flex: none; }
.brand-logo { height: 110px; width: auto; display: block; pointer-events: none; }
.nav-scroll { overflow-y: auto; padding: 10px 12px 24px; flex: 1; }
.nav-group { margin-top: 10px; }
.nav-group:not(:has(.nav-link:not([hidden]))) { display: none; }
.nav-caption { margin: 12px 10px 6px; color: #9a9ba1; font-size: 11px; letter-spacing: .06em; font-weight: 700; text-transform: uppercase; }
.sidebar .nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 2px 0; border-radius: 9px; color: var(--ink-2);
  font-size: 14px; font-weight: 600; text-decoration: none; border-inline-start: 3px solid transparent; transition: background .12s, color .12s;
}
.sidebar .nav-link:hover { background: #f4f4f5; color: var(--ink); }
.sidebar .nav-link.active { background: var(--brand-soft); color: var(--brand); border-inline-start-color: var(--brand); font-weight: 700; }
.nav-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: #8b8d94; font-size: 0; }
.sidebar .nav-link.active .nav-icon, .sidebar .nav-link:hover .nav-icon { color: var(--brand); }
.au-badge { background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; margin-left: 0; margin-inline-start: auto; }
.brand-stripe { height: 7px; background: repeating-linear-gradient(-60deg, var(--brand) 0 34px, #fff 34px 42px); }
.topbar { height: 62px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; gap: 14px; }
.breadcrumb { font-size: 13px; color: var(--muted); font-weight: 600; flex: 1; }
.breadcrumb span { color: #c4c5ca; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.lang-toggle { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 13px; cursor: pointer; }
.lang-toggle:hover { border-color: var(--brand); color: var(--brand); }
.au-user { font-size: 13px; color: var(--ink-2); }
.au-user .secondary-button { padding: 6px 12px; font-size: 12px; }
.menu-toggle { display: none; width: 40px; height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 10px; cursor: pointer; flex-direction: column; justify-content: center; align-items: center; gap: 4px; }
.menu-toggle span { width: 18px; height: 2px; background: var(--ink); border-radius: 2px; }
.nav-scrim { display: none; }
.content { padding: 28px 30px 48px; max-width: 1640px; }

/* ---------- typography & headings ---------- */
.page-heading { margin-bottom: 20px; align-items: center; }
.page-heading h1, .dialog-header h2 { font-family: var(--font); font-weight: 800; letter-spacing: 0; color: var(--ink); font-size: 26px; }
.eyebrow { color: var(--brand); letter-spacing: .08em; font-size: 11px; font-weight: 700; }
.subtitle { color: var(--muted); font-size: 14px; line-height: 1.7; max-width: 900px; }
.table-toolbar h2, .monthly-report-title h2 { font-family: var(--font); font-size: 16px; font-weight: 700; color: var(--ink); }
.table-toolbar p, .footnote, .field-hint { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.form-section-title { font-family: var(--font); font-size: 13px; color: var(--ink); }

/* ---------- buttons ---------- */
.primary-button, .secondary-button, .icon-button, .edit-button, .mt-tab { font-family: var(--font); }
.primary-button { background: var(--brand); color: #fff; border-radius: 9px; padding: 10px 18px; font-size: 14px; font-weight: 700; box-shadow: 0 2px 6px #c4161c33; }
.primary-button:hover { background: var(--brand-dark); }
.secondary-button { background: #fff; color: var(--ink); border: 1px solid #d9dade; border-radius: 9px; padding: 9px 14px; font-size: 13px; font-weight: 700; }
.secondary-button:hover { border-color: var(--brand); color: var(--brand); background: #fff; }
.edit-button { background: var(--brand-soft); border: 1px solid var(--brand-line); color: var(--brand); border-radius: 7px; padding: 6px 11px; font-size: 12px; font-weight: 700; }
.edit-button:hover { background: #fbdcde; }
.icon-button { background: #f2f2f4; color: var(--muted); border-radius: 8px; }
.icon-button:hover { background: #e9e9ec; color: var(--ink); }
.text-button { color: var(--brand); }

/* ---------- tabs ---------- */
.mt-tabs { gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: var(--shadow); }
.mt-tab { border: 0; background: transparent; color: var(--ink-2); border-radius: 8px; padding: 9px 14px; font-size: 13.5px; font-weight: 700; }
.mt-tab:hover { background: #f4f4f5; }
.mt-tab.active { background: var(--brand); color: #fff; box-shadow: 0 2px 6px #c4161c33; }
.mt-tab.active .au-badge { background: #fff; color: var(--brand); }

/* ---------- cards & tables ---------- */
.table-card, .monthly-machine-report, .movement-toolbar, .shift-select-toolbar, .summary-card, .payroll-calculation, .ci-card, .employee-pay-card {
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: #fff;
}
.table-card { margin-bottom: 16px; }
.table-toolbar { padding: 16px 20px; flex-wrap: wrap; }
.summary-row { gap: 12px; flex-wrap: wrap; }
.summary-card { width: auto; min-width: 200px; flex: 1 1 200px; max-width: 280px; padding: 16px 18px; }
.summary-icon { background: var(--brand-soft); color: var(--brand); border-radius: 10px; }
.summary-card strong { font-family: var(--font); font-size: 22px; font-weight: 800; color: var(--ink); }
.summary-label { font-size: 12.5px; color: var(--muted); }
table { min-width: 100%; }
#machines table { min-width: 1300px; }
thead { background: #fafafa; }
th { color: #6b6d74; font-size: 12px; letter-spacing: .02em; text-transform: none; padding: 12px 14px; font-weight: 700; }
td { color: var(--ink-2); font-size: 13px; padding: 12px 14px; border-bottom-color: #f0f0f2; }
tbody tr:hover { background: #fcf6f6; }
.table-scroll { min-height: 0; }
.empty-state .empty-icon { background: var(--brand-soft); color: var(--brand); }
.search-box { border-radius: 9px; height: 38px; border-color: #d9dade; }
.search-box input { font-size: 13px; }

/* ---------- forms ---------- */
.form-grid label, .mt-inline-form label, .employee-pay-card label, .payroll-terms-form label, .shift-bulk-form label { color: var(--ink-2); font-size: 13px; font-weight: 700; }
.form-grid input, .form-grid select, .mt-inline-form input, .mt-inline-form select, .mt-toolbar input, .date-picker input, .date-picker select, .mt-input,
.employee-pay-card input, .employee-pay-card select, .payroll-terms-form input, .payroll-terms-form select, .shift-bulk-form input, .shift-bulk-form select,
.shift-select-toolbar .date-picker select, .shift-select-toolbar .date-picker input, .adjustment-toolbar .date-picker select, .adjustment-toolbar .date-picker input, .wh-wh select {
  height: 40px; border: 1px solid #d9dade; border-radius: 9px; font-size: 14px; color: var(--ink); background: #fff;
}
.form-grid textarea, .mt-lines input, .wh-lines input { border-color: #d9dade; border-radius: 8px; font-size: 13.5px; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .mt-inline-form input:focus, .mt-inline-form select:focus, .mt-toolbar input:focus,
.date-picker input:focus, .date-picker select:focus, .mt-lines input:focus, .wh-lines input:focus, .search-box:focus-within, .shift-cell-input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px #c4161c1f;
}
.form-grid input.mt-auto, .form-grid input[readonly] { background: #f6f6f7; color: var(--ink-2); }
.date-picker { color: var(--ink-2); font-size: 13px; font-weight: 700; }
.form-error { background: #fff1f1; color: var(--danger); border: 1px solid #f5cccc; font-size: 13px; border-radius: 9px; }
.required { color: var(--brand); }

/* ---------- dialogs & toast ---------- */
.machine-dialog, .qr-dialog { border-radius: 16px; }
.machine-dialog::backdrop, .qr-dialog::backdrop { background: #1b1b1d99; }
.dialog-header { border-top: 5px solid var(--brand); }
.toast { left: 0 !important; right: 0; margin: 0 auto; width: max-content; max-width: calc(100vw - 32px); transform: translateY(12px) !important; }
.toast.visible { transform: translateY(0) !important; }
.toast { background: var(--ink); font-size: 14px; border-radius: 10px; border-inline-start: 4px solid var(--brand); }

/* ---------- status colours ---------- */
.pc-chip { background: var(--brand-soft); color: var(--brand); }
.pc-chip-x { color: var(--brand); }
.au-match, .pc-lowest, .ci-loc, .up-status.up-ok { color: var(--ok) !important; }
.ci-roles label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.ci-card h1 { font-family: var(--font); }
.hr-live { color: var(--brand); }
#hr .hr-alerts, .pay-missing-notice { border-inline-start: 4px solid #e0a100; }

/* ---------- right-to-left ---------- */
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
[dir="rtl"] .report-print-note { text-align: left; }
[dir="rtl"] .primary-button span { margin-right: 0; margin-left: 4px; }
[dir="rtl"] .mt-hint { margin-left: 0; margin-right: 8px; }
[dir="rtl"] .hr-actions .edit-button + .edit-button { margin-left: 0; margin-right: 4px; }
[dir="rtl"] .pay-missing-notice ul { padding-left: 0; padding-right: 18px; }
[dir="rtl"] .pay-missing-notice .secondary-button { margin-left: 0; margin-right: 6px; }
[dir="rtl"] .mt-toolbar input[type=checkbox] { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .shift-grid .shift-date-heading, [dir="rtl"] .shift-grid .shift-date-cell { left: auto; right: 0; text-align: right; }
[dir="rtl"] .shift-grid .night-group-heading, [dir="rtl"] .shift-grid .night-shift-cell, [dir="rtl"] .report-night-group { border-left: 0; border-right: 2px solid #dbe3e9 !important; }
[dir="rtl"] .payroll-table thead th:nth-child(8), [dir="rtl"] .payroll-table td:nth-child(8) { border-left: 0; border-right: 2px solid #9eadb9; }
[dir="rtl"] .search-symbol { transform: rotate(18deg) scaleX(-1); }
[dir="rtl"] input[type="number"], [dir="rtl"] input[type="tel"], [dir="rtl"] input[inputmode="numeric"], [dir="rtl"] input[type="email"] { direction: ltr; text-align: right; }
[dir="rtl"] .ci-code-row input { direction: ltr; text-align: center; }

/* ---------- tablets & phones ---------- */
@media (max-width: 960px) {
  .menu-toggle { display: inline-flex; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(280px, 85vw) !important; padding: 0 !important; display: none; box-shadow: 0 10px 40px #0000002e; animation: nav-in .18s ease; }
  [dir="rtl"] .sidebar { left: auto; right: 0; }
  body.nav-open .sidebar { display: flex; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: #1b1b1d66; z-index: 25; }
  .sidebar .brand-mark, .sidebar .brand-copy { display: none !important; }
  .sidebar .nav-caption { display: block !important; }
  .sidebar .nav-link:not([hidden]) { display: flex !important; font-size: 14px !important; justify-content: flex-start !important; padding: 10px 12px !important; }
  .topbar { padding: 0 14px; height: 58px; }
  .content { padding: 20px 14px 40px; }
  .au-user span#au-user-name { display: none; }
}
@media (max-width: 620px) {
  .page-heading h1 { font-size: 22px; }
  .breadcrumb { display: none; }
  .topbar-actions { margin-inline-start: auto; }
  .topbar-actions { gap: 6px; }
  .au-user .secondary-button { padding: 5px 8px; font-size: 11px; }
  .lang-toggle { padding: 5px 10px; font-size: 12px; }
  .mt-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .mt-tab { white-space: nowrap; flex: none; }
  .summary-card { max-width: none; }
  .mt-heading-actions { width: 100%; }
}
@media print { .brand-stripe, .menu-toggle, .lang-toggle, .nav-scrim { display: none !important; } }

@keyframes nav-in { from { opacity: 0; } to { opacity: 1; } }

/* Client invoices */
#invoicing .hint { color: #666; font-size: 13px; margin: 6px 0; }
#invoicing h3 { margin: 18px 0 8px; font-size: 15px; color: var(--brand, #c4161c); }
#invoicing .inv-check { flex-direction: row; align-items: center; gap: 8px; }
#invoicing .inv-docfields { margin: 12px 0; padding: 10px 14px; border: 1px solid #e3e3e3; border-radius: 10px; background: #fafafa; }
#invoicing .inv-docfields > summary { cursor: pointer; font-weight: 600; color: #9d1015; }
#invoicing .inv-docfields[open] > summary { margin-bottom: 10px; }
#invoicing .inv-wide { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
#invoicing .inv-wide textarea { width: 100%; min-height: 70px; font: inherit; padding: 8px; border: 1px solid #d6d6d6; border-radius: 8px; box-sizing: border-box; }
#invoicing .inv-docbar { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; border: 1px dashed #c9c9c9; border-radius: 10px; }
#invoicing .inv-docbar select { min-width: 0; }
#invoicing .inv-docbar label.inv-check { display: inline-flex; flex-direction: row !important; align-items: center; gap: 6px; font-size: 13px; }
#invoicing .inv-status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eee; color: #333; }
#invoicing .inv-draft { background: #fff4d6; color: #7a5300; }
#invoicing .inv-signed { background: #e3efff; color: #1d4f91; }
#invoicing .inv-issued { background: #e2f5e7; color: #1c6b34; }
#invoicing .inv-credited { background: #fdeced; color: #9d1015; }
#invoicing .inv-warnings { margin: 8px 0; padding: 8px 24px; background: #fff4d6; border-radius: 8px; color: #7a5300; }
#invoicing .inv-totals { max-width: 460px; }
#invoicing .inv-totals td:last-child { text-align: end; direction: ltr; }
#invoicing .inv-actions { flex-wrap: wrap; align-items: end; gap: 8px; }
#invoicing .inv-actions label { display: flex; flex-direction: column; font-size: 12px; }
#invoicing .mt-toolbar select { min-width: 220px; }
#invoicing .inv-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
#invoicing .inv-paid { background: #e2f5e7; color: #1c6b34; }
#invoicing .inv-conv { display: block; color: #666; font-size: 11px; }
#invoicing [hidden], #fuel [hidden] { display: none !important; }
#changes .chg-insert.inv-status { background: #e2f5e7; color: #1c6b34; } #changes .chg-delete.inv-status { background: #fdeced; color: #9d1015; } #changes .chg-update.inv-status { background: #e3efff; color: #1d4f91; } #changes s { color: #9d1015; } #changes td div { font-size: 12px; } #changes .inv-status { display:inline-block; padding:2px 10px; border-radius:999px; font-size:12px; font-weight:600; }
#approvals .inv-status { display:inline-block; padding:2px 10px; border-radius:999px; font-size:12px; font-weight:600; } #approvals .inv-draft { background:#fff4d6; color:#7a5300; } #approvals .inv-issued { background:#e2f5e7; color:#1c6b34; } #approvals .inv-credited { background:#fdeced; color:#9d1015; } #approvals .appr-note { min-width: 160px; } #approvals [hidden] { display:none !important; }
.mfa-dialog { border: 0; border-radius: 14px; padding: 0; max-width: 520px; width: calc(100% - 32px); } .mfa-dialog::backdrop { background: rgba(0,0,0,.55); } .mfa-box { padding: 22px; } .mfa-box h2 { margin: 0 0 10px; color: var(--brand, #c4161c); } .mfa-steps li { margin: 10px 0; } .mfa-steps input { display:block; margin-top:6px; font-size:22px; letter-spacing:6px; width: 180px; text-align:center; } .mfa-qr { margin: 8px 0; } .mfa-qr img { width: 200px; height: 200px; border: 1px solid #ddd; border-radius: 8px; } .mfa-codes { display:grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; } .mfa-codes code { font-size: 17px; background:#f6f6f6; padding:6px 10px; border-radius:6px; text-align:center; } .mfa-ok { color:#1c6b34; font-weight:600; } .mfa-box [hidden] { display:none !important; } .mfa-box code { word-break: break-all; }
.ci-queue { margin: 10px 0; } .ci-offline { background:#fff4d6; color:#7a5300; padding:10px 12px; border-radius:10px; font-weight:600; } .ci-q-item { display:flex; flex-wrap:wrap; gap:6px 12px; align-items:center; background:#f6f6f6; border-radius:10px; padding:8px 12px; margin:6px 0; } .ci-q-item small { color:#666; } .ci-q-failed { background:#fdeced; } .ci-queue[hidden] { display:none !important; }
