/* String Workforce — identity aligned with stringsystems.net (Figtree + IBM Plex Sans Arabic, #FF2D20 accent).
   Dark theme is the default; [data-theme="light"] switches to the light palette. Layout uses logical properties so RTL/LTR both work. */
:root {
  --accent: rgba(220, 58, 46, 0.5);
  --accent-solid: #dc3a2e;
  --accent-soft: rgba(220, 58, 46, 0.12);
  --accent-dark: rgba(220, 58, 46, 0.85);
  --btn: #e5e7eb;
  --btn-text: #111827;
  --btn-hover: #ffffff;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --info: #93c5fd;
  --bg: #0b0d12;
  --bg-2: #12151c;
  --card: #171b24;
  --border: #262c3a;
  --border-strong: #343c4e;
  --text: #e5e7eb;
  --text-strong: #ffffff;
  --muted: rgba(229, 231, 235, 0.6);
  --input-bg: #0f1218;
  --radius: 8px;
  --shadow: 0 4px 6px -1px rgba(0,0,0,.45), 0 2px 4px -2px rgba(0,0,0,.4);
  --sidebar-w: 240px;
  --badge-ok-bg: rgba(74, 222, 128, .15);
  --badge-warn-bg: rgba(251, 191, 36, .15);
  --badge-danger-bg: rgba(248, 113, 113, .18);
  --badge-info-bg: rgba(147, 197, 253, .15);
  color-scheme: dark;
}
[data-theme="light"] {
  --accent-dark: rgba(220, 58, 46, 0.85);
  --btn: #1f2937;
  --btn-text: #ffffff;
  --btn-hover: #374151;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --info: #1d4ed8;
  --bg: #f9fafb;
  --bg-2: #f3f4f6;
  --card: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-strong: #000000;
  --muted: rgba(0, 0, 0, 0.55);
  --input-bg: #ffffff;
  --shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --badge-ok-bg: #dcfce7;
  --badge-warn-bg: #ffedd5;
  --badge-danger-bg: #fee2e2;
  --badge-info-bg: #dbeafe;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Figtree, "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
html[lang="ar"] body { font-family: "IBM Plex Sans Arabic", Figtree, "Segoe UI", Tahoma, system-ui, sans-serif; }
a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }
code { background: var(--bg-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 4px; font-size: 0.92em; direction: ltr; unicode-bidi: embed; }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 1rem; color: var(--text-strong); }
h2 { font-size: 1.2rem; font-weight: 600; margin: 1.5rem 0 0.75rem; color: var(--text-strong); }
h3 { font-size: 1.05rem; font-weight: 600; margin: 1rem 0 0.5rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.inline { display: inline; }
.ltr { direction: ltr; unicode-bidi: embed; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.grow { flex: 1 1 auto; }
.right { text-align: end; }
hr { border: 0; border-top: 1px solid var(--border); }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 600; font-size: 1.1rem; color: var(--text-strong); line-height: 1.15; }
.brand:hover { color: var(--text-strong); }
.brand svg { width: 34px; height: 34px; flex-shrink: 0; }
.brand small { display: block; font-size: 0.68rem; font-weight: 500; color: var(--muted); letter-spacing: 0.02em; }
.brand-lg { flex-direction: column; text-align: center; gap: 0.5rem; margin: 0 auto 1.25rem; font-size: 1.35rem; }
.brand-lg svg { width: 56px; height: 56px; }

/* ---------- top bar / shell ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-right { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: transparent; color: var(--text); cursor: pointer; font: inherit;
}
.icon-btn:hover { background: var(--bg-2); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.lang-switch { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; }
.lang-switch a { padding: 0.3rem 0.6rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.lang-switch a.active { background: var(--accent); color: #fff; }
.lang-switch a:hover:not(.active) { background: var(--bg-2); color: var(--text); }
.impersonation-banner {
  background: var(--accent); color: #fff; padding: 0.5rem 1.25rem; text-align: center; font-size: 0.95rem;
  display: flex; gap: 0.75rem; align-items: center; justify-content: center;
}
.shell { display: flex; flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-inline-end: 1px solid var(--border);
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar a { padding: 0.5rem 1.25rem; color: var(--text); display: block; border-inline-start: 3px solid transparent; }
.sidebar a:hover { background: var(--bg-2); color: var(--text-strong); }
.sidebar a.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; border-inline-start-color: var(--accent); }
.sidebar a.highlight { color: var(--accent); font-weight: 600; }
.sidebar .nav-group { padding: 0.9rem 1.25rem 0.25rem; font-size: 0.72rem; text-transform: uppercase; color: var(--muted); letter-spacing: 0.08em; }
.company-box { padding: 0 1.25rem 0.75rem; border-bottom: 1px solid var(--border); margin-bottom: 0.5rem; }
.company-name { font-weight: 600; color: var(--text-strong); }
.content { flex: 1; padding: 1.5rem; max-width: 1400px; width: 100%; margin: 0 auto; min-width: 0; }
.footer { text-align: center; padding: 1rem; }

/* ---------- cards / tables ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; }
.card-title { font-weight: 600; margin-bottom: 0.75rem; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; color: var(--text-strong); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.stat .value { font-size: 1.8rem; font-weight: 600; color: var(--text-strong); }
.stat .label { color: var(--muted); font-size: 0.9rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border); text-align: start; vertical-align: middle; }
th { background: var(--bg-2); font-weight: 600; font-size: 0.8rem; white-space: nowrap; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover td { background: var(--bg-2); }
td.num, th.num { text-align: center; font-variant-numeric: tabular-nums; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

/* ---------- forms ---------- */
form.stack > * + * { margin-top: 0.9rem; }
label { display: block; font-weight: 500; margin-bottom: 0.3rem; font-size: 0.9rem; color: var(--text); }
label.check { font-weight: 400; display: flex; align-items: center; gap: 0.5rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: 0.55rem 0.75rem; border: 1px solid var(--border-strong); border-radius: 6px; font: inherit; color: var(--text);
  background: var(--input-bg); box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
input:disabled { opacity: .6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 90px; }
.field-hint { color: var(--muted); font-size: 0.82rem; margin-top: 0.25rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.9rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; }
.filters { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters label { margin-bottom: 0.2rem; }
.filters > div { min-width: 160px; }
.validation-summary-errors ul { margin: 0; padding-inline-start: 1.2rem; }
.validation-summary-errors { color: var(--danger); background: var(--badge-danger-bg); border: 1px solid var(--danger); border-radius: 6px; padding: 0.6rem 0.9rem; }
.validation-summary-valid { display: none; }
.field-validation-error { color: var(--danger); font-size: 0.85rem; }

/* ---------- buttons / badges / alerts ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 0.55rem 1.1rem; border-radius: 6px; border: 1px solid transparent; font: inherit;
  font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer;
  background: var(--btn); color: var(--btn-text); text-decoration: none; line-height: 1.2; white-space: nowrap; transition: background .15s ease, color .15s ease;
}
.btn:hover { background: var(--btn-hover); color: var(--btn-text); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-2); color: var(--text-strong); }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-danger:hover { background: #991b1b; color: #fff; }
.btn-ok { background: #15803d; color: #fff; }
.btn-ok:hover { background: #166534; color: #fff; }
.btn-warn { background: #b45309; color: #fff; }
.btn-warn:hover { background: #92400e; color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--bg-2); color: var(--text-strong); }
.btn-light { background: #fff; color: var(--accent); }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.72rem; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 0.9rem; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.badge { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: var(--bg-2); color: var(--text); border: 1px solid var(--border); }
.badge-ok { background: var(--badge-ok-bg); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--badge-warn-bg); color: var(--warn); border-color: transparent; }
.badge-danger { background: var(--badge-danger-bg); color: var(--danger); border-color: transparent; }
.badge-info { background: var(--badge-info-bg); color: var(--info); border-color: transparent; }
.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: var(--badge-ok-bg); border-color: var(--ok); color: var(--ok); }
.alert-error { background: var(--badge-danger-bg); border-color: var(--danger); color: var(--danger); }
.alert-warn { background: var(--badge-warn-bg); border-color: var(--warn); color: var(--warn); }
.alert-info { background: var(--badge-info-bg); border-color: var(--info); color: var(--info); }
.alert a { color: inherit; text-decoration: underline; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.auth-card { max-width: 440px; margin: 1rem auto 2rem; padding: 1.5rem; }
.auth-card h1 { text-align: center; font-size: 1.25rem; }
.auth-page { min-height: calc(100vh - 60px); display: flex; flex-direction: column; justify-content: center; padding-top: 2rem; }
details summary { cursor: pointer; font-weight: 600; }
.pager { display: flex; gap: 0.5rem; align-items: center; margin-top: 1rem; }
.photo-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.temp-pass { font-family: Consolas, monospace; font-size: 1.2rem; background: var(--badge-warn-bg); border: 1px dashed var(--accent); padding: 0.5rem 1rem; border-radius: 6px; direction: ltr; display: inline-block; color: var(--text-strong); }

/* ---------- landing (stringsystems.net welcome layout) ---------- */
.landing { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.landing-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 2.5rem; }
.landing-header nav { display: flex; gap: 0.25rem; align-items: center; flex-wrap: wrap; }
.landing-header nav a { padding: 0.5rem 0.75rem; border-radius: 6px; color: var(--text); }
.landing-header nav a:hover { color: var(--accent); }
.landing-hero { text-align: center; margin-bottom: 2.5rem; }
.landing-hero h1 { font-size: 2rem; font-weight: 600; margin-bottom: 0.5rem; }
.landing-hero p { color: var(--muted); max-width: 640px; margin: 0 auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; }
.tile {
  display: flex; flex-direction: column; gap: 1rem; padding: 1.5rem; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border); color: var(--text);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
.tile:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }
.tile .icon { width: 48px; height: 48px; border-radius: 999px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.tile .icon svg { width: 26px; height: 26px; fill: var(--accent); }
.tile h2 { margin: 0; font-size: 1.15rem; }
.tile p { margin: 0; color: var(--muted); font-size: 0.93rem; }
.tile .go { margin-top: auto; color: var(--accent); font-weight: 600; font-size: 0.9rem; }
.landing-footer { margin-top: 3rem; text-align: center; color: var(--muted); font-size: 0.85rem; }
.landing-footer a { color: var(--accent); }

/* ---------- employee (mobile-first) ---------- */
.employee-body { background: var(--bg); }
.topbar-employee { height: 56px; }
.content-employee { max-width: 560px; margin: 0 auto; padding: 1rem; padding-bottom: 1.5rem; }
.tabbar {
  position: fixed; bottom: 0; inset-inline: 0; background: var(--card); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; z-index: 20; min-height: 60px; padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* the fixed tab bar must not cover the end of the page: the footer keeps clear of it (plus the phone's home-indicator area) */
.with-tabbar .footer { padding-bottom: calc(1.25rem + 60px + env(safe-area-inset-bottom, 0px)); }
.tabbar a { flex: 1; text-align: center; padding: 0.7rem 0.2rem; color: var(--muted); font-size: 0.8rem; border-top: 3px solid transparent; }
.tabbar a.active { color: var(--accent); font-weight: 600; border-top-color: var(--accent); }
.clock-state { text-align: center; padding: 1rem 0; }
.clock-state .time { font-size: 2.6rem; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; direction: ltr; }
.clock-state .status { font-size: 1.05rem; margin-top: 0.25rem; }
.clock-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1rem; }
.clock-buttons .btn { padding: 1.1rem 0.5rem; font-size: 0.95rem; }
.clock-buttons .full { grid-column: 1 / -1; }
.camera-box { margin-top: 1rem; }
.camera-box img { width: 100%; max-height: 300px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.geo-line { font-size: 0.9rem; color: var(--muted); margin-top: 0.5rem; text-align: center; }
.watermark {
  position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: 0.07; overflow: hidden;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 3rem; padding: 2rem; font-size: 1.1rem; transform: rotate(-20deg);
}
.privacy-blur { filter: blur(14px); }
.day-list { list-style: none; margin: 0; padding: 0; }
.day-list li { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 0.6rem; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.day-list .meta { color: var(--muted); font-size: 0.85rem; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; border-inline-end: 0; border-bottom: 1px solid var(--border); padding: 0.5rem; gap: 0.25rem; }
  .sidebar a { padding: 0.4rem 0.7rem; border-radius: 6px; border-inline-start: 0; }
  .sidebar .nav-group, .company-box { display: none; }
  .content { padding: 1rem; }
  th, td { padding: 0.45rem 0.5rem; font-size: 0.9rem; }
  .landing-header { flex-direction: column; align-items: flex-start; }
  .topbar .muted { display: none; }
}
@media print {
  :root { --bg: #fff; --card: #fff; --text: #000; --muted: #444; --border: #ccc; }
  .topbar, .sidebar, .footer, .tabbar, .filters, .actions, .btn { display: none !important; }
  .content { padding: 0; }
}

/* ---------- shared footer / landing hero / theme icon ---------- */
.footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem 0.6rem; padding: 1.25rem 1rem; border-top: 1px solid var(--border); margin-top: auto; }
.footer a { color: var(--accent); }
.top-nav { display: flex; gap: 0.25rem; }
.top-nav a { padding: 0.4rem 0.6rem; border-radius: 6px; font-size: 0.9rem; }
.top-nav a:hover { background: var(--bg-2); }
.landing { max-width: 1100px; margin: 0 auto; padding: 2.5rem 1.25rem 3rem; width: 100%; text-align: center; }
.landing-hero { margin-bottom: 2.5rem; }
.hero-logo svg { width: 96px; height: 96px; display: block; margin: 0 auto 0.75rem; }
.hero-sub { color: var(--muted); font-weight: 500; letter-spacing: 0.04em; margin-bottom: 1rem; }
.tiles { justify-items: stretch; text-align: start; }
.tile h2 { text-align: start; }
.theme-btn svg { width: 20px; height: 20px; }
.icon-moon { fill: #fbbf24; }
.icon-sun { fill: #f59e0b; color: #f59e0b; }
.icon-auto { fill: currentColor; }
[data-theme="light"] .icon-moon { fill: #4b5563; }
.cert-box { text-align: center; }
@media (max-width: 600px) {
  .topbar { padding: 0 0.75rem; }
  .top-nav { display: none; }
  .brand span { font-size: 0.95rem; }
  .hero-logo svg { width: 72px; height: 72px; }
  .landing-hero h1 { font-size: 1.6rem; }
  .content { padding: 0.75rem; }
  .card { padding: 1rem; }
}
@media (min-width: 601px) and (max-width: 1024px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
}

/* theme button shows exactly one icon depending on the chosen mode */
.theme-btn svg { display: none; width: 20px; height: 20px; }
.theme-btn[data-mode="dark"] .icon-moon, .theme-btn[data-mode="light"] .icon-sun, .theme-btn[data-mode="auto"] .icon-auto { display: block; }
.theme-btn { background: var(--bg-2); }
.theme-btn[data-mode="light"] { background: #fff7e6; border-color: #f59e0b; }
.theme-btn[data-mode="dark"] { background: #1e2433; border-color: #fbbf24; }
[data-theme="light"] .theme-btn[data-mode="dark"] { background: #e5e7eb; border-color: #4b5563; }
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* fixed LTR layout for every language; Arabic text itself still renders right-to-left inside its boxes */
html[lang="ar"] .content, html[lang="ar"] .landing, html[lang="ar"] .card, html[lang="ar"] .sidebar a, html[lang="ar"] .tile, html[lang="ar"] .day-list li, html[lang="ar"] .alert, html[lang="ar"] td, html[lang="ar"] th, html[lang="ar"] label, html[lang="ar"] p, html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 { unicode-bidi: plaintext; }

/* brand bar under the header (logo lives here, not in the header) */
.brand-bar { display: flex; justify-content: center; padding: 1.25rem 1rem 0.75rem; }
.brand-bar .brand-lg { margin-bottom: 0; }
.topbar-left { flex: 1; display: flex; align-items: center; min-width: 0; }
.topbar-left .brand { font-size: 1rem; }
.topbar-left .brand svg { width: 28px; height: 28px; }
.topbar { max-width: 100%; }
.topbar-inner { width: 100%; max-width: 1400px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
details > summary { list-style: none; cursor: pointer; display: inline-flex; }
details > summary::-webkit-details-marker { display: none; }
@media (max-width: 600px) { .topbar-left .brand small { display: none; } }
.auth-page { padding-top: 0.5rem; min-height: auto; }
.footer { flex-direction: column; gap: 0.15rem; line-height: 1.5; }
@media (max-width: 600px) { .brand-bar .brand-lg svg { width: 44px; height: 44px; } .brand-bar .brand-lg { font-size: 1.1rem; } }

/* no horizontal page scroll on phones: flex children may shrink, tables scroll inside their wrapper */
.row > *, .grow, .stats > *, .grid-3 > * { min-width: 0; }
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.card { max-width: 100%; box-sizing: border-box; }
@media (max-width: 600px) { .row { flex-direction: column; } .row > .card { width: 100%; } }

/* install-app buttons (shown only when the browser offers installation) */
.install-btn { white-space: nowrap; }
.install-row { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; margin-top: 1rem; }
@media (max-width: 600px) { .topbar .install-btn { display: none; } }

/* password eye */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-inline-end: 2.6rem; width: 100%; box-sizing: border-box; }
.pw-eye { position: absolute; top: 50%; inset-inline-end: 0.35rem; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; padding: 0; }
.pw-eye:hover { color: var(--text-strong); background: var(--bg-2); }
.pw-eye svg { width: 20px; height: 20px; fill: currentColor; }
.pw-eye .eye-closed, .pw-visible .pw-eye .eye-open { display: none; }
.pw-visible .pw-eye .eye-closed { display: block; }

/* Arabic reads bolder on desktop screens */
@media (min-width: 861px) {
  html[lang="ar"] body { font-weight: 500; }
  html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3, html[lang="ar"] strong, html[lang="ar"] .card-title, html[lang="ar"] th { font-weight: 700; }
  html[lang="ar"] .btn, html[lang="ar"] label, html[lang="ar"] .sidebar a, html[lang="ar"] .top-nav a { font-weight: 600; }
}

/* sidebar meets the header; on phones the menu becomes an orderly grid of buttons */
.sidebar { padding-top: 0.75rem; }
.content > .brand-bar { padding-top: 0.5rem; }
@media (max-width: 860px) {
  .sidebar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; padding: 0.6rem; }
  .sidebar a { text-align: center; padding: 0.55rem 0.5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-2); font-size: 0.9rem; border-inline-start: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sidebar a.active { border-color: var(--accent); }
  .sidebar .nav-group, .sidebar .company-box, .sidebar form { display: none; }
}
@media (max-width: 600px) {
  .sidebar { grid-template-columns: repeat(2, 1fr); }
}

/* menu flush with the left edge on desktop; header spans the full width to match; content stays centered */
.shell { max-width: none; margin: 0; }
.topbar-inner { max-width: none; }
.content { max-width: 1400px; margin: 0 auto; }
.brand-bar-mobile { display: none; }
@media (max-width: 860px) {
  .brand-bar-mobile { display: block; }
  .brand-bar-desktop { display: none; }
  .brand-bar-mobile .brand-bar { padding: 0.9rem 1rem 0.5rem; }
}

/* footer link: calmer red at 50% opacity */
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { color: var(--accent-dark); }

/* ================= icons ================= */
.ic { width: 1.15em; height: 1.15em; fill: currentColor; flex-shrink: 0; vertical-align: -0.2em; margin-inline-end: 0.45em; opacity: 0.9; }
.sidebar a { display: flex; align-items: center; }
.card-title .ic { color: var(--accent-solid, #dc3a2e); }
.tabbar a .ic { display: block; margin: 0 auto 2px; width: 1.4em; height: 1.4em; }
@media (max-width: 860px) { .sidebar a { justify-content: center; } }

/* ================= live dashboard ================= */
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.tile-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; padding: 0.9rem 1rem; border-radius: 16px; border: 1px solid var(--border); background: var(--card);
  color: var(--text); cursor: pointer; text-align: start; font: inherit; position: relative; overflow: hidden; transition: transform .12s ease, border-color .12s ease; }
.tile-stat:hover { transform: translateY(-2px); }
.tile-stat.selected { border-color: var(--tone, var(--accent-solid, #dc3a2e)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tone, #dc3a2e) 35%, transparent); }
.tile-stat::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: var(--tone, var(--border)); }
.tile-stat .ic { position: absolute; inset-inline-end: 0.8rem; top: 0.8rem; width: 1.6rem; height: 1.6rem; margin: 0; color: var(--tone, var(--muted)); opacity: 0.85; }
.tile-stat .num { font-size: 1.9rem; font-weight: 600; color: var(--text-strong); line-height: 1.1; }
.tile-stat .num small { font-size: 0.95rem; font-weight: 500; color: var(--muted); margin-inline-start: 0.25rem; }
.tile-stat .lbl { font-size: 0.85rem; color: var(--muted); }
.t-in { --tone: #22c55e; } .t-break { --tone: #f59e0b; } .t-left { --tone: #3b82f6; } .t-late { --tone: #f97316; } .t-early { --tone: #eab308; }
.t-absent { --tone: #ef4444; } .t-notyet { --tone: #94a3b8; } .t-leave { --tone: #8b5cf6; } .t-off { --tone: #64748b; }
.dash-pending { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.pill { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: 0.88rem; }
.pill b { color: var(--text-strong); }
a.pill:hover { border-color: var(--accent-solid, #dc3a2e); color: var(--text-strong); }
.dash-groups tr.clickable { cursor: pointer; } .dash-groups tr.clickable:hover td { background: var(--bg-2); }
.dash-groups tr.selected td { background: var(--accent-soft); }
td.ok { color: #22c55e; font-weight: 600; } td.warn { color: #f59e0b; } td.bad { color: #ef4444; font-weight: 600; }
.bar { display: inline-block; width: 70px; height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; vertical-align: middle; margin-inline-end: 0.4rem; }
.bar i { display: block; height: 100%; background: #22c55e; border-radius: 999px; }
.chips { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; margin-inline-start: 0.5rem; }
.chip { font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--accent-soft); color: var(--text-strong); }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; margin-inline-start: 0.5rem; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: livepulse 2s infinite; }
.live-dot.stale { background: #f59e0b; animation: none; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 9px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* ================= reports / profile ================= */
.tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.9rem; }
.tab { padding: 0.4rem 0.9rem; border-radius: 999px; border: 1px solid var(--border); color: var(--text); font-size: 0.9rem; }
.tab.active { background: var(--accent-soft); border-color: var(--accent-solid, #dc3a2e); color: var(--text-strong); font-weight: 600; }
table.kv { width: 100%; } table.kv th { width: 40%; text-align: start; color: var(--muted); font-weight: 500; padding: 0.3rem 0.5rem 0.3rem 0; vertical-align: top; border: 0; }
table.kv td { padding: 0.3rem 0; border: 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.6rem; }
.gallery figure { margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg-2); }
.gallery img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; }
.gallery figcaption { padding: 0.3rem 0.4rem; font-size: 0.75rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }
.map { height: 300px; border-radius: 14px; border: 1px solid var(--border); margin-top: 0.6rem; overflow: hidden; z-index: 0; }
.map.map-sm { height: 220px; }
.temp-pass { font-family: ui-monospace, Consolas, monospace; font-weight: 600; }

/* ================= liquid glass (translucent, blurred surfaces; palette unchanged) ================= */
body {
  background:
    radial-gradient(900px 520px at 8% -8%, rgba(220, 58, 46, 0.13), transparent 60%),
    radial-gradient(800px 480px at 105% 8%, rgba(80, 120, 255, 0.10), transparent 60%),
    radial-gradient(700px 500px at 50% 115%, rgba(220, 58, 46, 0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
.card, .stat, .tile, .tile-stat, .pill, .auth-card, .gallery figure {
  background: color-mix(in srgb, var(--card) 58%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid color-mix(in srgb, var(--text-strong) 13%, transparent);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.16), inset 0 1px 0 color-mix(in srgb, #ffffff 16%, transparent);
  border-radius: 20px;
}
.card .card { box-shadow: none; }
.topbar, .sidebar, .tabbar {
  background: color-mix(in srgb, var(--card) 52%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border-color: color-mix(in srgb, var(--text-strong) 10%, transparent);
}
.btn { border-radius: 13px; box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 22%, transparent), 0 2px 10px rgba(0, 0, 0, 0.10); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.btn-secondary, .btn-ghost, .icon-btn { background: color-mix(in srgb, var(--bg-2) 55%, transparent); }
input, select, textarea { border-radius: 12px; background: color-mix(in srgb, var(--bg-2) 62%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.badge, .tab, .chip { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.alert { border-radius: 16px; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.sidebar a { border-radius: 12px; margin: 1px 8px; border-inline-start-width: 0; }
.sidebar a.active { box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 14%, transparent); }
[data-theme="light"] .card, [data-theme="light"] .stat, [data-theme="light"] .tile, [data-theme="light"] .tile-stat, [data-theme="light"] .pill, [data-theme="light"] .auth-card {
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  border-color: rgba(15, 23, 42, 0.08);
}
@media (prefers-reduced-transparency: reduce) {
  .card, .stat, .tile, .tile-stat, .pill, .auth-card, .topbar, .sidebar, .tabbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--card); }
}

/* ================= co-brand: platform logo and the company's own logo in one glass capsule ================= */
.cobrand {
  display: inline-flex; align-items: center; gap: 1rem; max-width: 100%; box-sizing: border-box;
  padding: 0.6rem 1.15rem; border-radius: 24px; position: relative; overflow: hidden;
  background: color-mix(in srgb, var(--card) 48%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(185%); backdrop-filter: blur(24px) saturate(185%);
  border: 1px solid color-mix(in srgb, var(--text-strong) 14%, transparent);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18), inset 0 1px 0 color-mix(in srgb, #ffffff 22%, transparent), inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}
/* soft light sweep across the top of the glass */
.cobrand::before { content: ""; position: absolute; inset: 0 0 55% 0; pointer-events: none; background: linear-gradient(to bottom, color-mix(in srgb, #ffffff 10%, transparent), transparent); }
.cobrand > * { position: relative; }
.cobrand .brand { margin: 0; min-width: 0; flex-shrink: 0; }
.cobrand-sep { width: 1px; align-self: stretch; margin: 0.1rem 0; flex-shrink: 0; background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--text-strong) 32%, transparent), transparent); }
.cobrand-company { display: inline-flex; align-items: center; gap: 0.65rem; min-width: 0; color: var(--text-strong); font-weight: 600; text-decoration: none; }
a.cobrand-company:hover { color: var(--text-strong); }
.cobrand-logo {
  height: 44px; min-width: 44px; max-width: 136px; object-fit: contain; flex-shrink: 0; box-sizing: border-box;
  padding: 4px; border-radius: 13px; background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14), inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}
.cobrand-mono { display: inline-flex; align-items: center; justify-content: center; width: 44px; padding: 0; font-size: 1.2rem; font-weight: 700; color: var(--accent-solid); background: color-mix(in srgb, var(--bg-2) 72%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-strong) 12%, transparent); }
.cobrand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; unicode-bidi: plaintext; }
[data-theme="light"] .cobrand { box-shadow: 0 10px 30px rgba(15, 23, 42, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.8); border-color: rgba(15, 23, 42, 0.08); }
@media (max-width: 600px) {
  .cobrand { gap: 0.6rem; padding: 0.5rem 0.75rem; border-radius: 20px; }
  .cobrand .brand { gap: 0.45rem; }
  .cobrand .brand svg { width: 28px; height: 28px; }
  .cobrand .brand span { font-size: 0.88rem; }
  .cobrand .brand small { display: none; }
  .cobrand-logo { height: 36px; min-width: 36px; max-width: 92px; border-radius: 11px; }
  .cobrand-mono { width: 36px; font-size: 1rem; }
  .cobrand-name { max-width: 104px; font-size: 0.88rem; }
}
@media (max-width: 360px) { .cobrand-name { display: none; } }
@media (prefers-reduced-transparency: reduce) { .cobrand { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--card); } }
/* company logo in the admin sidebar */
.company-logo { display: block; height: 46px; max-width: 100%; object-fit: contain; box-sizing: border-box; padding: 4px; margin-bottom: 0.5rem; border-radius: 12px; background: rgba(255, 255, 255, 0.94); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); }
/* phones: the header keeps only the glyph (the name sits in the bar below); tab labels stay on one line */
@media (max-width: 600px) {
  .topbar-left .brand > span { display: none; }
  .tabbar a { min-width: 0; padding: 0.55rem 0.1rem; font-size: 0.68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* admin users: inline edit form of the account holder */
.user-edit { display: inline-block; vertical-align: top; }
.user-edit[open] { display: block; margin: 0.4rem 0; }
.user-edit-form { margin-top: 0.5rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 12px; min-width: 240px; text-align: start; }
td form.inline, td details.inline { margin: 2px; }

/* notifications: unread / read / handled */
.notif-head { margin-bottom: 0.75rem; }
.notif-list li { padding: 0; }
.notif-item { display: block; padding: 0.7rem 0.9rem; color: inherit; text-decoration: none; border-radius: 12px; }
.notif-item:hover { background: color-mix(in srgb, var(--text-strong) 6%, transparent); color: inherit; }
.notif-unread strong { font-weight: 700; color: var(--text-strong); }
.notif-read strong { font-weight: 500; }
.notif-read .meta { opacity: 0.8; }
.notif-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-solid); margin-inline-end: 0.45rem; vertical-align: middle; }
.notif-state { margin-top: 0.35rem; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.notif-detail { border-color: color-mix(in srgb, var(--accent-solid) 45%, transparent); }
.count-badge { display: inline-block; min-width: 1.25rem; padding: 0 0.35rem; margin-inline-start: 0.3rem; border-radius: 999px; background: var(--accent-solid); color: #fff; font-size: 0.72rem; font-weight: 700; line-height: 1.25rem; text-align: center; }
.chip { display: inline-block; padding: 0.1rem 0.5rem; margin: 0.1rem; border-radius: 999px; border: 1px solid var(--border); }

/* setup wizard: one slide per step */
.wizard-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.6rem; padding: 0; }
.wizard-steps li { flex: 1 1 110px; }
.wizard-steps button { width: 100%; display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.6rem; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--muted); cursor: pointer; font: inherit; text-align: start; }
.wizard-steps .num { flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-strong); font-weight: 600; font-size: 0.85rem; }
.wizard-steps .lbl { font-size: 0.85rem; line-height: 1.2; }
.wizard-steps li.done .num { background: var(--badge-ok-bg); color: var(--ok); border-color: transparent; }
.wizard-steps li.current button { border-color: var(--accent-solid); color: var(--text-strong); }
.wizard-steps li.current .num { background: var(--accent-solid); color: #fff; border-color: transparent; }
.wizard-progress { height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; margin-bottom: 1rem; }
.wizard-progress .bar { height: 100%; width: 0; background: var(--accent-solid); transition: width 0.3s ease; }
.wizard-slide { overflow: hidden; }
.wizard-slide.from-next { animation: wizard-in-next 0.3s ease; }
.wizard-slide.from-back { animation: wizard-in-back 0.3s ease; }
@keyframes wizard-in-next { from { opacity: 0; transform: translateX(48px); } to { opacity: 1; transform: none; } }
@keyframes wizard-in-back { from { opacity: 0; transform: translateX(-48px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wizard-slide.from-next, .wizard-slide.from-back { animation: none; } }
.wizard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.wizard-head h2 { margin: 0 0 0.25rem; }
.wizard-frame { width: 100%; height: calc(100vh - 360px); min-height: 440px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.wizard-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; }
.wizard [hidden] { display: none !important; }
@media (max-width: 700px) { .wizard-steps .lbl { display: none; } .wizard-steps li { flex: 1 1 0; } .wizard-steps button { justify-content: center; padding: 0.4rem; } .wizard-frame { height: calc(100vh - 300px); } }
/* a page shown inside the wizard: only its content */
html.embedded .topbar, html.embedded .sidebar, html.embedded .footer, html.embedded .brand-bar, html.embedded .brand-bar-mobile, html.embedded .brand-bar-desktop, html.embedded .impersonation-banner { display: none !important; }
html.embedded body { min-height: 0; }
html.embedded .content { padding: 0.75rem; }
.notif-item { flex: 1; }

/* policies: the platform's terms page, and a company's own policy text as typed */
.policy-page h2 { font-size: 1.05rem; margin: 1.4rem 0 0.4rem; }
.policy-page p { line-height: 1.9; }
.policy-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.9; padding: 0.9rem 1rem; margin: 0.5rem 0 0.75rem; border: 1px solid var(--border); border-radius: 12px; background: var(--input-bg); max-height: 60vh; overflow-y: auto; unicode-bidi: plaintext; }
