/* FPC Self Service — brand styling (LTR/RTL) + app-like mobile design
   Brand: FPC blue #104681 · navy #092B55 · steel gray #6D7278 */
:root {
  --primary: #104681;
  --primary-dark: #092B55;
  --primary-grad: linear-gradient(135deg, #0D3A6E 0%, #1B5CA8 100%);
  --primary-light: #E9F0F8;
  --accent: #6D7278;
  --bg: #F3F6FA;
  --card: #ffffff;
  --text: #1A2433;
  --muted: #66707E;
  --border: #DCE4EE;
  --danger: #B3372F;
  --danger-bg: #FBEAE9;
  --success: #1C7A44;
  --success-bg: #E8F5EC;
  --amber-bg: #FDF3E0;
  --amber: #9A6B12;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(9, 43, 85, .07);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary); text-decoration: none; }

.desktop-only { display: initial; }
.mobile-only { display: none !important; }

/* ---------- top bar ---------- */
/* padding-top keeps the brand bar clear of the iPhone status bar / notch when
   the PWA runs standalone with a translucent status bar */
.topbar { background: var(--primary-grad); color: #fff; position: sticky; top: 0; z-index: 50;
          padding-top: env(safe-area-inset-top); }
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 20px; height: 60px;
}
.brand { color: #fff; font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.brand-logo {
  background: #fff; border-radius: 9px; padding: 4px 7px; display: flex; align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.brand-logo img { height: 24px; display: block; }
.nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.nav a { color: #D7E4F2; padding: 6px 12px; border-radius: 8px; font-size: 14.5px; }
.nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 14px; margin-inline-start: auto; }
.lang-switch {
  color: #fff; border: 1px solid rgba(255,255,255,.45); border-radius: 8px;
  padding: 3px 10px; font-size: 13px;
}
.lang-switch:hover { background: rgba(255,255,255,.12); }
.who { color: #D7E4F2; }
.who:hover { color: #fff; }
.logout { color: #FFD9D4; font-size: 13px; }
.bell { position: relative; font-size: 17px; text-decoration: none; }
.bell-badge {
  position: absolute; top: -6px; inset-inline-end: -9px;
  background: #E4572E; color: #fff; font-size: 10.5px; font-weight: 700;
  border-radius: 999px; padding: 1px 5px; line-height: 1.3;
}
.notif-unread { background: var(--primary-light); }

/* ---------- layout ---------- */
.container { max-width: 1100px; margin: 24px auto 60px; padding: 0 20px; }
h1 { font-size: 23px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 24px 0 10px; }
.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}

/* ---------- balances ---------- */
.balance-card { position: relative; overflow: hidden; }
.balance-card::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  width: 4px; background: var(--primary-grad);
}
.balance-card .bal-top { display: flex; justify-content: space-between; align-items: baseline; }
.balance-card h3 { margin: 0 0 4px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.bal-num { font-size: 30px; font-weight: 800; color: var(--primary); }
.bal-sub { color: var(--muted); font-size: 13px; }
.bal-bar { height: 7px; background: var(--border); border-radius: 4px; margin-top: 10px; overflow: hidden; }
.bal-bar span { display: block; height: 100%; background: var(--primary-grad); border-radius: 4px; }

/* ---------- quick actions ---------- */
.actions-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.action-btn {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 12px; font-weight: 600; color: var(--primary); font-size: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s ease;
}
.action-btn:hover { border-color: var(--primary); transform: translateY(-2px); }
.action-btn .emoji { font-size: 26px; margin: 0; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; background: var(--card); }
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; background: var(--card); box-shadow: var(--shadow); }
th, td { padding: 11px 14px; text-align: start; font-size: 14px; }
th { background: var(--primary-light); color: var(--primary-dark); font-weight: 700; white-space: nowrap; }
tr + tr td { border-top: 1px solid var(--border); }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge-pending, .badge-pending_manager, .badge-pending_hr { background: var(--amber-bg); color: var(--amber); }
.badge-approved { background: var(--success-bg); color: var(--success); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }
.badge-cancelled { background: #ECEFF3; color: #667; }

/* ---------- forms ---------- */
form.stack { display: grid; gap: 14px; max-width: 520px; }
label { font-weight: 600; font-size: 14px; display: block; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid #E2E8F0; border-radius: 12px;
  font: inherit; background: #FBFCFE; color: var(--text); font-size: 15px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary);
  background: #fff; box-shadow: 0 0 0 4px rgba(16, 70, 129, .12); }
textarea { min-height: 90px; resize: vertical; }
.btn {
  display: inline-block; background: var(--primary-grad); color: #fff; border: 0;
  padding: 11px 22px; border-radius: 10px; font-weight: 600; font-size: 15px; cursor: pointer;
  box-shadow: 0 2px 6px rgba(16, 70, 129, .25);
}
.btn:hover { filter: brightness(1.08); }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); box-shadow: none; }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { filter: brightness(.92); }
.btn-sm { padding: 6px 14px; font-size: 13.5px; }
.inline-form { display: inline; }

/* ---------- flash ---------- */
.flash { padding: 11px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 14.5px; }
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid #BFE3CB; }
.flash-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #EEC5C2; }

/* ---------- login ---------- */
.login-wrap { min-height: calc(100vh - 0px); display: flex; align-items: center; justify-content: center;
  background: var(--primary-grad); margin: -24px -20px -60px; padding: 30px 20px; }
.login-card { width: 390px; max-width: 94vw; text-align: center; padding: 36px 30px; border: 0; }
.login-logo img { height: 52px; }
.login-card h1 { font-size: 20px; margin: 16px 0 4px; }
.login-card p.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }
.login-card form { display: grid; gap: 12px; text-align: start; }
.demo-note { margin-top: 18px; font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--border); padding-top: 12px; }

/* ---------- login v2 (sign-in redesign) ---------- */
body { overflow-x: hidden; }  /* 100vw includes the scrollbar on Windows — never side-scroll */
.login-wrap { overflow: hidden;                     /* clip the floating orbs   */
  margin-inline: calc(50% - 50vw); }                /* full-bleed on any screen */
.lc2-flash { margin: 0 0 16px; text-align: start; font-size: 13.5px; padding: 10px 14px;
  border-radius: 10px; animation: cardIn .3s ease; }
.login-scene { position: relative; width: 100%; max-width: 420px;
  display: flex; justify-content: center; }
.login-orb { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .35;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.75), rgba(255,255,255,.04) 65%);
  animation: orbFloat 9s ease-in-out infinite; pointer-events: none; }
.login-orb.o1 { width: 220px; height: 220px; top: -130px; inset-inline-start: -60px; }
.login-orb.o2 { width: 130px; height: 130px; bottom: -80px; inset-inline-end: -30px; animation-delay: -3s; }
.login-orb.o3 { width: 70px; height: 70px; top: 40px; inset-inline-end: -90px; animation-delay: -6s; }
@keyframes orbFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(16px); } }

.login-card.lc2 { position: relative; width: 400px; padding: 40px 32px 26px; border-radius: 22px;
  box-shadow: 0 24px 60px rgba(4, 22, 46, .38); animation: cardIn .45s cubic-bezier(.2,.9,.3,1.2); }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.lc2 .login-logo { display: inline-flex; padding: 14px 22px; border-radius: 16px;
  background: #fff; box-shadow: 0 6px 18px rgba(16, 70, 129, .14); }
.lc2 .login-logo img { height: 46px; }
.lc2 h1 { font-size: 21px; margin: 18px 0 4px; color: var(--primary-dark); }
.lc2 p.sub { margin-bottom: 24px; }
.lc2-lang { position: absolute; top: 16px; inset-inline-end: 16px; font-size: 12.5px;
  color: var(--primary); border: 1px solid #D6E2F0; border-radius: 999px; padding: 4px 12px;
  background: #F4F8FC; }
.lc2-lang:hover { background: #E8F0F9; }

.lc2-field { text-align: start; }
.lc2-field label { display: block; font-size: 13px; font-weight: 600; color: var(--primary-dark);
  margin-bottom: 6px; }
.lc2-input { position: relative; display: flex; align-items: center; }
.lc2-input svg:first-child { position: absolute; inset-inline-start: 14px; width: 18px; height: 18px;
  color: #9AA8B8; pointer-events: none; }
.lc2-input input { width: 100%; height: 50px; border: 1.5px solid #E2E8F0; border-radius: 13px;
  background: #F7F9FC; padding: 0 44px; font-size: 15px; transition: border-color .15s, background .15s, box-shadow .15s; }
.lc2-input input::placeholder { color: #A9B4C2; font-size: 13.5px; }
.lc2-input input:focus { outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 4px rgba(16, 70, 129, .12); }
.lc2-eye { position: absolute; inset-inline-end: 8px; width: 36px; height: 36px; border: 0;
  background: transparent; color: #9AA8B8; cursor: pointer; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; }
.lc2-eye svg { width: 19px; height: 19px; }
.lc2-eye:hover, .lc2-eye.on { color: var(--primary); }

.lc2-submit { height: 52px; border-radius: 13px; font-size: 16px; margin-top: 6px;
  box-shadow: 0 10px 24px rgba(16, 70, 129, .35); transition: transform .12s, box-shadow .12s, filter .12s; }
.lc2-submit:hover { transform: translateY(-1px); filter: brightness(1.06); }
.lc2-submit:active { transform: translateY(0); }
.lc2-submit.busy span { visibility: hidden; }
.lc2-submit.busy::after { content: ""; position: absolute; width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite; }
.lc2-submit { position: relative; display: flex; align-items: center; justify-content: center; }
@keyframes spin { to { transform: rotate(360deg); } }

.lc2-foot { margin-top: 22px; padding-top: 14px; border-top: 1px solid #EEF2F7;
  font-size: 11.5px; color: #A2AEBC; }

@media (max-width: 480px) {
  .login-card.lc2 { width: 100%; padding: 34px 22px 20px; border-radius: 20px; }
}

/* ---------- dashboard hero ---------- */
.hero { background: var(--primary-grad); color: #fff; border-radius: 18px;
  padding: 22px 24px; margin-bottom: 22px; position: relative; overflow: hidden;
  box-shadow: 0 10px 26px rgba(9, 43, 85, .22); }
.hero::after { content: ""; position: absolute; width: 190px; height: 190px; border-radius: 50%;
  background: rgba(255,255,255,.07); top: -90px; inset-inline-end: -50px; }
.hero-hi { font-size: 20px; font-weight: 800; }
.hero-sub { color: #C9DAEC; font-size: 13px; margin-top: 2px; }
.hero-chip { display: inline-block; margin-top: 12px; background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 600; }
.hero-chip:hover { background: rgba(255,255,255,.26); }

/* ---------- request rows (lists work on any screen — no cramped tables) ---------- */
.req-list { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }
.req-row { display: flex; align-items: center; gap: 14px; color: inherit;
  padding: 14px 16px; transition: transform .12s, box-shadow .12s, border-color .12s; }
.req-row:hover { transform: translateY(-1px); border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(9, 43, 85, .10); }
.req-ic { font-size: 24px; flex: 0 0 auto; background: var(--primary-light);
  width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center;
  justify-content: center; }
.req-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.req-title { font-weight: 700; font-size: 14.5px; color: var(--primary-dark); }
.req-sub { color: var(--muted); font-size: 12.5px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.req-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.req-date { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* ---------- admin tabs (scrollable chip row) ---------- */
.admin-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs .btn { flex: 0 0 auto; white-space: nowrap; }

/* ---------- list search ---------- */
.list-search { position: relative; max-width: 380px; margin-bottom: 12px; }
.list-search svg { position: absolute; inset-inline-start: 13px; top: 50%;
  transform: translateY(-50%); width: 17px; height: 17px; color: #9AA8B8; pointer-events: none; }
.list-search input { height: 44px; padding-inline-start: 40px; border-radius: 12px; }

/* ---------- request-type designer + live preview ---------- */
.designer-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr);
  gap: 20px; align-items: start; }
#fields-table select { min-width: 130px; }
#fields-table input:not([type=checkbox]) { min-width: 110px; }
.preview-pane { position: sticky; top: 76px; }
.preview-head { font-weight: 700; color: var(--primary-dark); margin-bottom: 8px; font-size: 14px; }
@media (max-width: 900px) { .designer-grid { grid-template-columns: 1fr; }
  .preview-pane { position: static; } }

/* ---------- printable document (certificate) ---------- */
.doc-cert { max-width: 780px; }
.doc-meta { display: flex; justify-content: space-between; color: var(--muted);
  font-size: 13px; margin-bottom: 18px; }
.doc-to { font-size: 15px; }
.doc-body { font-size: 15.5px; line-height: 2; }
.doc-sign { display: flex; justify-content: space-between; gap: 40px; margin-top: 56px;
  text-align: center; font-weight: 600; }
.doc-sign > div { flex: 1; }
.doc-sign .line { border-top: 1.5px solid var(--text); margin-bottom: 8px; }

/* ---------- workflow setup ---------- */
.wfcard { max-width: 640px; margin-bottom: 18px; }
.wf-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.wf-steps { margin: 0; padding-inline-start: 22px; display: grid; gap: 8px; }
.wf-steps select { max-width: 420px; }
.wf-self { margin-top: 12px; display: grid; gap: 6px; }
.wf-self label { font-weight: 500; font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
/* workflows overview list — click a type to open its setup */
.wf-list { display: grid; gap: 10px; max-width: 720px; }
.wf-row { display: flex; align-items: center; gap: 12px; background: var(--card, #fff);
  border: 1px solid var(--line, #e3e8f0); border-radius: 14px; padding: 14px 16px;
  text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.wf-row:hover { border-color: var(--brand, #104681); box-shadow: 0 2px 10px rgba(16,70,129,.08); }
.wf-row-icon { font-size: 22px; }
.wf-row-main { flex: 1; display: grid; gap: 2px; min-width: 0; }
.wf-row-main .bal-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-row-go { color: var(--muted, #8a94a6); font-size: 20px; }
/* FO buffer field designer */
.fo-cols td { vertical-align: top; }
.fo-cols .fo-if { display: none; gap: 6px; flex-direction: column; min-width: 170px; }
.fo-row[data-mode="input"] .fo-if-input { display: flex; }
.fo-row[data-mode="input"][data-type="select"] .fo-if-options { display: flex; margin-top: 6px; }
.fo-row[data-mode="fixed"] .fo-if-fixed { display: flex; }
/* Design Form rows: behaviour-dependent inputs */
.d-details { display: grid; gap: 6px; min-width: 150px; }
.d-details .d-if { display: none; }
.d-row[data-mode="input"][data-type="select"] .d-if-select { display: block; }
.d-row[data-mode="fixed"] .d-if-fixed { display: block; }
.d-row:not([data-mode="input"]) .req-col input { visibility: hidden; }
/* choice lists: one value per line */
textarea.opts-box { min-height: 76px; min-width: 160px; resize: vertical;
  font-size: 13px; line-height: 1.7; }
/* preview dialog (Design Form) */
dialog.preview-dlg { border: 0; border-radius: 16px; padding: 0;
  width: min(460px, 94vw); box-shadow: 0 24px 70px rgba(9, 43, 85, .4); }
dialog.preview-dlg::backdrop { background: rgba(9, 43, 85, .45); }
.preview-dlg-head { display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line, #e3e8f0);
  font-weight: 700; color: var(--primary-dark, #092B55); }
.preview-dlg-body { padding: 18px; max-height: 72vh; overflow: auto; }
/* my team */
.team-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.behalf-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* FO-style shift assignment: worker list + range lines */
.fo-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px; align-items: start; }
@media (max-width: 800px) {
  .fo-layout { grid-template-columns: 1fr; }
  .emp-pane { position: static; max-height: 64vh; }
  /* JS adds .mob: the editor lives in the popup, the page shows the list */
  .fo-layout.mob .lines-pane { display: none; }
  dialog.lines-dlg { width: min(560px, 96vw); }
  .lines-dlg .card { border: 0; box-shadow: none; padding: 4px 0 0; margin: 0; }
  /* each line becomes a stacked mini-card: shift on top, from/to side by side */
  .lines-dlg .table-wrap { border: 0; box-shadow: none; overflow: visible; }
  .lines-dlg #lines-table { display: block; }
  .lines-dlg #lines-table tr:first-child { display: none; }   /* header row */
  .lines-dlg #lines-table tr { display: block; position: relative;
    border: 1px solid var(--border, #e3e8f0); border-radius: 12px;
    padding: 10px 12px; margin-bottom: 10px; background: var(--bg-soft, #f7fafd); }
  .lines-dlg #lines-table td { display: block; border: 0; padding: 3px 0;
    background: transparent; }
  .lines-dlg #lines-table td[data-l]::before { content: attr(data-l);
    display: block; font-size: 11px; color: var(--muted, #8a94a6);
    margin-bottom: 2px; }
  .lines-dlg #lines-table td:nth-child(2),
  .lines-dlg #lines-table td:nth-child(3) { display: inline-block;
    width: calc(50% - 5px); vertical-align: top; }
  .lines-dlg #lines-table td:nth-child(2) { margin-inline-end: 8px; }
  .lines-dlg #lines-table td:last-child { position: absolute; top: 8px;
    inset-inline-end: 8px; width: auto; padding: 0; }
  .lines-dlg #lines-table select,
  .lines-dlg #lines-table input[type=date] { width: 100%; min-width: 0; }
}
.emp-pane { background: #fff; border: 1px solid var(--line, #e3e8f0);
  border-radius: 14px; padding: 10px; max-height: 74vh; overflow: auto;
  position: sticky; top: 76px; }
.emp-filter { width: 100%; margin-bottom: 8px; }
.emp-list { display: grid; gap: 2px; }
.emp-item { display: flex; align-items: center; gap: 8px; padding: 9px 10px;
  border-radius: 10px; text-decoration: none; color: inherit; }
.emp-item:hover { background: var(--bg-soft, #f4f7fb); }
.emp-item.active { background: #eef4fb; box-shadow: inset 3px 0 0 var(--brand, #104681); }
.emp-pn { font-weight: 800; font-size: 12.5px; color: var(--brand, #104681); min-width: 46px; }
.emp-nm { flex: 1; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lines-table select { min-width: 200px; }
#lines-table input[type=date] { min-width: 140px; }

/* monthly shift schedule grid */
.sched-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.sched-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--line, #e3e8f0);
  border-radius: 12px; background: #fff; }
.sched-grid { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.sched-grid th, .sched-grid td { border-bottom: 1px solid var(--line, #e3e8f0);
  padding: 4px 4px; background: #fff; white-space: nowrap; }
.sched-grid thead-row th { position: sticky; top: 0; }
.sched-grid tr:first-child th { position: sticky; top: 0; z-index: 3;
  background: var(--bg-soft, #f4f7fb); }
.sched-grid .emp-col { position: sticky; inset-inline-start: 0; z-index: 2;
  background: #fff; min-width: 170px; box-shadow: 0 0 0 1px var(--line, #e3e8f0); }
.sched-grid tr:first-child .emp-col { z-index: 4; background: var(--bg-soft, #f4f7fb); }
.sched-grid .qf-col { min-width: 150px; }
.sched-grid .qf { max-width: 120px; }
.sched-grid th.we, .sched-grid td.we { background: #fdf6ec; }
.sched-grid th.mstart { border-inline-start: 3px solid var(--brand, #104681); }
.sched-grid .d-num { font-weight: 800; }
.sched-grid .d-dow { font-size: 10.5px; color: var(--muted, #8a94a6); }
select.sc { min-width: 108px; max-width: 130px; font-size: 12px; padding: 4px 6px;
  color: var(--muted, #8a94a6); }
select.sc.filled { color: var(--primary-dark, #092B55); font-weight: 600;
  background: #eef4fb; border-color: #b9cfe8; }
/* employee's own schedule */
.my-sched tr.we td { background: #fdf6ec; }
.my-sched tr.off td { color: var(--muted, #8a94a6); }
/* live balance check on the leave form */
.days-ok { color: var(--success, #1d7a3e) !important; font-weight: 700; }
.days-err { color: var(--danger, #c0392b) !important; font-weight: 700; }
.balance-card.active { outline: 2px solid var(--brand, #104681); outline-offset: -1px; }
#submit-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- empty states ---------- */
.empty-state { text-align: center; color: var(--muted); padding: 44px 16px; }
.empty-state .es-ic { font-size: 42px; display: block; margin-bottom: 8px; opacity: .7; }

/* ---------- request detail ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 24px; }
.detail-grid .item .k { color: var(--muted); font-size: 12.5px; }
.detail-grid .item .v { font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .meta { color: var(--muted); font-size: 12.5px; }

/* ---------- payslip ---------- */
.payslip { max-width: 720px; }
.payslip-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--primary); padding-bottom: 14px; margin-bottom: 16px; }
.payslip h1 { margin: 0; font-size: 20px; color: var(--primary-dark); }
.pay-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.net-row { margin-top: 16px; background: var(--primary-grad); color: #fff; border-radius: 10px; padding: 14px 18px; display: flex; justify-content: space-between; font-size: 17px; font-weight: 700; }

/* payslip list (employee) */
.slip-list { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.slip-card { display: flex; justify-content: space-between; align-items: center; gap: 14px;
  color: inherit; text-decoration: none; transition: transform .12s, box-shadow .12s; }
.slip-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(9, 43, 85, .12); }
.slip-month { font-size: 16.5px; font-weight: 700; color: var(--primary-dark); }
.slip-sums { display: flex; gap: 12px; margin-top: 4px; font-weight: 600; }
.slip-sums .pos { color: var(--success); }
.slip-sums .neg { color: var(--danger); }
.slip-net { text-align: center; background: var(--primary-soft, #EEF3FA); border-radius: 12px;
  padding: 10px 16px; min-width: 118px; }
.slip-net .k { font-size: 11px; color: var(--muted); }
.slip-net .v { font-size: 17px; font-weight: 800; color: var(--primary); }
.slip-net .cur { font-size: 11px; color: var(--muted); }

/* payslip attendance strip + line hints */
.att-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.att-chip { background: #F1F4F9; border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; color: var(--muted); }
.att-chip strong { color: var(--text, #1c2733); margin-inline-start: 4px; }
.att-chip.pos strong { color: var(--success); }
.att-chip.neg strong { color: var(--danger); }
.qty-hint { display: inline-block; margin-inline-start: 6px; font-size: 11.5px;
  color: var(--muted); background: #F1F4F9; border-radius: 6px; padding: 1px 6px; }
.employer-note { margin-top: 14px; border: 1px dashed var(--border); border-radius: 10px;
  padding: 10px 14px; font-size: 13px; color: var(--muted); }
.employer-note .k { font-weight: 600; margin-bottom: 4px; }
.employer-note .row { display: flex; justify-content: space-between; }

/* ---------- SPA transitions + progress bar ---------- */
#spa-bar { position: fixed; top: 0; inset-inline-start: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--primary), #4A90D9); z-index: 90;
  transition: width .25s ease, opacity .3s; opacity: 0; }
#spa-bar.loading { width: 70%; opacity: 1; }
#spa-bar.done { width: 100%; opacity: 0; }
#main.spa-enter { animation: spaIn .22s ease; }
@keyframes spaIn { from { opacity: .25; transform: translateY(6px); }
                   to { opacity: 1; transform: none; } }

/* ---------- bottom navigation (mobile app feel) ---------- */
.bottom-nav {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 60;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: flex-end;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(9, 43, 85, .08);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 10.5px; padding: 4px 2px; border-radius: 10px;
}
.bottom-nav a.active { color: var(--primary); font-weight: 700; }
.bottom-nav .bn-icon { font-size: 21px; line-height: 1.15; }
.bottom-nav .bn-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 74px; }
.bottom-nav .bn-fab {
  flex: 0 0 auto; background: var(--primary-grad); color: #fff; width: 52px; height: 52px;
  border-radius: 50%; align-items: center; justify-content: center; font-size: 28px; font-weight: 700;
  margin-top: -24px; box-shadow: 0 6px 16px rgba(16, 70, 129, .40); border: 3px solid #fff;
}

/* ---------- mobile ---------- */
@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: initial !important; }
  nav.bottom-nav.mobile-only { display: flex !important; }

  .topbar-inner { height: 56px; padding: 0 14px; gap: 10px; }
  .brand-name { font-size: 14px; }
  .container { margin: 16px auto 96px; padding: 0 14px; }
  h1 { font-size: 20px; }
  .card { padding: 14px 16px; border-radius: 12px; }

  /* balances become a swipeable strip */
  .grid-3 { display: flex; overflow-x: auto; gap: 12px; padding-bottom: 6px;
            scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .grid-3 .balance-card { min-width: 150px; flex: 0 0 auto; scroll-snap-align: start; }
  .grid-3::-webkit-scrollbar { display: none; }

  .actions-row { grid-template-columns: repeat(2, 1fr); }
  .pay-tables { grid-template-columns: 1fr; }
  th, td { padding: 10px 10px; font-size: 13.5px; }
  .btn { width: auto; }
  form.stack .btn { width: 100%; }
  .hide-m { display: none !important; }         /* secondary table columns */
  .hero { padding: 18px 18px; border-radius: 16px; }
  .req-row { padding: 12px 13px; gap: 11px; }
  .req-ic { width: 40px; height: 40px; font-size: 20px; border-radius: 11px; }
  .login-wrap { margin-block: -16px -96px; }    /* match mobile container spacing */

  /* ---- app-wide mobile polish (primary device is the phone) ---- */
  input, select, textarea { font-size: 16px; }  /* stops iOS focus auto-zoom */
  dialog.preview-dlg { width: 96vw; }
  .preview-dlg-body { padding: 14px; max-height: 76vh; }
  .sched-bar { gap: 8px; }
  .sched-bar form { flex-wrap: wrap; }
  .sched-bar select { min-width: 0 !important; max-width: 100%; flex: 1 1 160px; }
  .team-actions { gap: 8px; }
  .team-actions .btn { flex: 1 1 46%; text-align: center; }
  .wf-steps select, .wf-form select { max-width: 100%; }
  .wf-row { padding: 12px 13px; }
  .wf-row-main .bal-sub { white-space: normal; }
  .behalf-note { font-size: 13.5px; }
  .fo-cols .fo-if { min-width: 120px; }
  .d-details { min-width: 120px; }
  .emp-item { padding: 12px 10px; }             /* comfortable touch targets */
  .emp-pn { min-width: 52px; }
  #lines-table select { min-width: 150px; }
  #lines-table input[type=date] { min-width: 126px; }
  .my-sched td, .my-sched th { white-space: nowrap; }
  .flash { font-size: 13.5px; }
}

@media print {
  .topbar, .no-print, .flash, .bottom-nav { display: none !important; }
  body { background: #fff; }
  .container { margin: 0; max-width: none; }
  .card { border: 0; padding: 0; box-shadow: none; }
}

/* ---------------------------------------------- PWA: install prompt & sheet */

.pwa-banner {
  position: fixed; z-index: 90; inset-inline: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 10px 34px rgba(9, 43, 85, .22);
  padding: 12px 14px; display: flex; align-items: center; gap: 12px;
  transform: translateY(140%); transition: transform .28s ease;
}
.pwa-banner.in { transform: none; }
.pwa-banner .pwa-icon { width: 44px; height: 44px; border-radius: 11px; flex: none; }
.pwa-banner .pwa-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.pwa-banner .pwa-txt strong { font-size: 14.5px; color: var(--primary-dark); }
.pwa-banner .pwa-txt span { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.pwa-banner .pwa-go { flex: none; padding: 9px 16px; font-size: 14px; }
.pwa-banner .pwa-x {
  flex: none; background: none; border: 0; cursor: pointer; color: var(--muted);
  font-size: 22px; line-height: 1; padding: 0 2px; align-self: flex-start;
}
@media (min-width: 769px) {
  .pwa-banner { inset-inline: auto; inset-inline-end: 20px; bottom: 20px; max-width: 430px; }
}
/* the bottom nav owns the bottom edge on phones — sit above it */
@media (max-width: 768px) {
  body[data-signed-in] .pwa-banner { bottom: calc(74px + env(safe-area-inset-bottom)); }
}

.pwa-back {
  position: fixed; inset: 0; z-index: 100; background: rgba(9, 43, 85, .45);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
@media (min-width: 769px) { .pwa-back { align-items: center; } }
.pwa-sheet {
  background: var(--card); border-radius: 18px; padding: 22px 20px 18px;
  width: 100%; max-width: 420px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
.pwa-sheet h3 { margin: 0 0 12px; font-size: 17px; color: var(--primary-dark); }
.pwa-steps { margin: 0; padding-inline-start: 20px; display: grid; gap: 10px; }
.pwa-steps li { font-size: 14px; line-height: 1.6; color: var(--text); }
/* iOS share glyph so the step is recognisable at a glance */
.pwa-share {
  display: inline-block; width: 15px; height: 19px; vertical-align: -4px;
  margin-inline-end: 7px; background: currentColor; color: var(--primary);
  -webkit-mask: no-repeat center / contain; mask: no-repeat center / contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 30'%3E%3Cpath d='M12 1 7 6.5l1.4 1.4L11 5.3V19h2V5.3l2.6 2.6L17 6.5 12 1z'/%3E%3Cpath d='M4 12h4v2H6v13h12V14h-2v-2h4v17H4V12z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 30'%3E%3Cpath d='M12 1 7 6.5l1.4 1.4L11 5.3V19h2V5.3l2.6 2.6L17 6.5 12 1z'/%3E%3Cpath d='M4 12h4v2H6v13h12V14h-2v-2h4v17H4V12z'/%3E%3C/svg%3E");
}
.pwa-note { font-size: 12.5px; color: var(--muted); margin: 14px 0 16px; }
.pwa-sheet .pwa-ok { width: 100%; }

.pwa-card .pwa-txt-block { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.pwa-card .pwa-done { margin: 0; color: var(--success); font-weight: 600; }
