:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --text: #1c2330;
  --muted: #6a7282;
  --primary: #1e4a72;
  --primary-hover: #163a5a;
  --primary-soft: #e8eff6;
  --accent: #c47a17;
  --success: #17794a;
  --success-soft: #e5f4ec;
  --warning: #a8590b;
  --warning-soft: #fdf1e2;
  --danger: #b3261e;
  --danger-soft: #fbe9e8;
  --info: #1e4a72;
  --info-soft: #e8eff6;
  --side-bg: #18212e;
  --side-text: #b9c2cf;
  --side-active: #ffffff;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --font: 'IBM Plex Sans Arabic', Tahoma, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
small { font-size: 12px; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--side-bg);
  color: var(--side-text);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand img { width: 34px; height: 34px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px; }
.nav { padding: 10px 0 24px; }
.nav a {
  display: block;
  padding: 8px 18px;
  color: var(--side-text);
  border-inline-start: 3px solid transparent;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .04); text-decoration: none; }
.nav a.active { color: var(--side-active); background: rgba(255, 255, 255, .07); border-inline-start-color: var(--accent); }
.nav-title {
  padding: 16px 18px 6px;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #7d8796;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-title { font-size: 17px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-end { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.topbar-end a { color: var(--muted); }
.topbar-end a:hover { color: var(--text); }
.topbar-end .user-link { color: var(--text); font-weight: 500; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.menu-btn span { display: block; width: 20px; height: 2px; background: var(--text); margin: 4px 0; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.sidebar-backdrop { display: none; }

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.panel.no-pad { padding: 0; overflow-x: auto; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 14px;
}
.panel-head.pad { padding: 14px 18px 0; margin: 0 0 6px; }
.panel-head h3 { font-size: 15px; }
.panel-head:not(:first-child) { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.panel-head.pad:not(:first-child) { border-top: 0; }
.form-narrow { max-width: 720px; }
.form-wide { max-width: 1000px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-2 > .panel { margin-bottom: 0; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  border-inline-start: 3px solid var(--primary);
}
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 22px; font-weight: 600; margin-top: 2px; }
.stat-value small { color: var(--muted); font-weight: 400; }
.stat-sub { font-size: 12px; color: var(--muted); }
.text-warning { color: var(--warning) !important; }

/* Toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-end { display: flex; align-items: center; gap: 12px; }
.search { display: flex; gap: 8px; }
.search input { width: 260px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: #3c4554; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
.form-grid .span-2 { grid-column: span 2; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 7px 10px;
  min-height: 36px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30, 74, 114, .12); }
input:disabled { background: #f6f7f9; color: var(--muted); }
textarea { resize: vertical; }
.input-sm { width: 110px !important; min-height: 32px !important; padding: 4px 8px !important; }
.input-xs { width: 70px !important; min-height: 32px !important; padding: 4px 8px !important; }
.search select { width: 160px; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; margin: 4px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 18px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.logo-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo-preview { width: 80px; height: 80px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; background: #fff; }
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.filters .field { margin-bottom: 0; }
.filters-actions { display: flex; gap: 8px; }
.inline-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; min-width: 220px; }
form.inline { display: inline; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 500;
  padding: 7px 16px;
  min-height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #f6f7f9; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-sm { min-height: 30px; padding: 3px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.danger, .link-btn.danger { color: var(--danger); }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); background: #f9fafb; white-space: nowrap; }
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact td, .table.compact th { padding: 8px 12px; }
.panel > .table.compact { margin: 0 -20px; width: calc(100% + 40px); }
.table .actions { white-space: nowrap; text-align: end; }
.table .actions > * + * { margin-inline-start: 12px; }
.start { text-align: start !important; }
.nowrap { white-space: nowrap; }
td.nowrap { direction: ltr; unicode-bidi: isolate; }
[dir=rtl] td.nowrap { text-align: right; }
.mono { font-family: Consolas, 'Courier New', monospace; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { text-align: center !important; color: var(--muted); padding: 28px !important; }
.panel.empty { padding: 40px; }

/* Badges / chips */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef0f3;
  color: #4b5563;
  white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #eef0f3; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 5px 12px; border-radius: var(--radius); background: var(--primary-soft); color: var(--primary); font-size: 13px; }
.chip-muted { background: #f0f1f3; color: var(--muted); }

/* Alerts */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: #c4e5d3; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #f2c8c5; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #f4d9b5; }

/* Pager */
.pager { display: flex; gap: 6px; justify-content: center; margin: 6px 0 18px; }
.pager a { min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--text); }
.pager a.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager a:hover { text-decoration: none; border-color: var(--primary); }

/* Permissions */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.perm-group { margin: 0; display: flex; flex-direction: column; }
.perm-group legend { font-weight: 600; padding: 0 6px; }

/* Auth */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--side-bg); }
.auth-box { width: 100%; max-width: 380px; background: var(--surface); border-radius: 8px; padding: 30px 28px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.auth-box h2 { font-size: 20px; margin-bottom: 8px; }
.auth-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 3px solid var(--accent); }
.auth-head h2 { margin: 0; }
.auth-head .lang-switch { font-size: 13px; color: var(--muted); }
.auth-box .btn-block { margin-top: 6px; }

/* Responsive */
@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar {
    position: fixed;
    inset-inline-start: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  [dir=rtl] .sidebar { transform: translateX(100%); }
  .nav-open .sidebar { transform: none !important; }
  .nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 30; }
  .menu-btn { display: block; }
  .topbar { padding: 0 14px; }
  .topbar-end { gap: 10px; }
  .topbar-end .user-link { display: none; }
  .content { padding: 16px; }
  .form-grid, .filters { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .search, .search input { width: 100%; }
  .toolbar > * { width: 100%; }
  .toolbar-end { justify-content: space-between; }
}

/* Tabs */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--border); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tabs a span { font-size: 11px; background: #eef0f3; color: var(--muted); border-radius: 999px; padding: 1px 7px; margin-inline-start: 4px; }

/* Numbers */
.num, .table th.num, .table td.num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table td.num, .table th.num { direction: ltr; unicode-bidi: isolate; }
[dir=rtl] .table td.num, [dir=rtl] .table th.num { text-align: left; }
.num-input { text-align: end; direction: ltr; font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }
.text-danger { color: var(--danger) !important; }
.toolbar-start { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.action-bar { display: flex; gap: 10px; align-items: center; margin: 4px 0 18px; }
.danger-zone { margin: 8px 0 24px; }
.pre { white-space: pre-line; }

/* Record header */
.record-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.record-code { font-family: Consolas, monospace; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.record-sub { font-size: 13px; margin-top: 2px; }
.progress-box { min-width: 200px; }
.progress { height: 8px; background: #e6e9ee; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--success); }
.progress.sm { height: 5px; width: 80px; display: inline-block; vertical-align: middle; margin-inline-end: 6px; }

/* Definition lists */
.details { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 8px 14px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.details.cols-2 { grid-template-columns: 140px 1fr 140px 1fr; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* BOQ / claim tables */
.boq-table .desc, .claim-table .desc { white-space: pre-line; min-width: 260px; }
.col-no { width: 90px; white-space: nowrap; }
.col-unit { width: 100px; }
.col-num { width: 130px; }
.col-type { width: 90px; }
.col-act { width: 96px; white-space: nowrap; text-align: center !important; }
.section-row td { background: #f2f4f7; font-weight: 600; }
.subtotal-row td { background: #fafbfc; font-weight: 500; color: #3c4554; }
.total-row td { background: #eef2f6; font-weight: 700; }
.var-row td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
[dir=rtl] .var-row td:first-child { box-shadow: inset -3px 0 0 var(--accent); }
.changed { color: var(--accent); font-weight: 600; }
.over-qty td { background: var(--warning-soft) !important; }
.over-qty .f-cum { color: var(--danger); font-weight: 600; }

.boq-edit td { padding: 4px 6px; vertical-align: top; }
.boq-edit input, .boq-edit textarea, .boq-edit select, .claim-table input, #dedGrid input {
  min-height: 32px !important; padding: 4px 8px !important; border-color: #e6e9ee !important; background: #fff !important;
}
.boq-edit input:focus, .boq-edit textarea:focus, .boq-edit select:focus, .claim-table input:focus, #dedGrid input:focus {
  border-color: var(--primary) !important; background: #fff !important;
}
.boq-edit tbody tr:hover input, .boq-edit tbody tr:hover textarea, .boq-edit tbody tr:hover select, .claim-table tr:hover input { border-color: var(--border) !important; background: #fff !important; }
.claim-table input { border-color: var(--border) !important; background: #fff !important; }
.boq-edit textarea { resize: none; overflow: hidden; line-height: 1.5; }
.boq-edit .section-row textarea { font-weight: 600; }
.boq-edit .f-total { padding-top: 10px; }
.mini-btn { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 4px; background: #fff; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; margin: 3px 1px; }
.mini-btn:hover { color: var(--text); border-color: var(--border-strong); }
.mini-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; margin-top: 0; z-index: 5; align-items: center; }

/* Claim summary */
.summary-table td:first-child { white-space: normal; }
.summary-table tr.deduct td:first-child { color: var(--muted); }
.net-due { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--primary-soft); }
.net-due strong { font-size: 20px; color: var(--primary); direction: ltr; unicode-bidi: isolate; }

@media (max-width: 760px) {
  .form-grid.cols-4, .details.cols-2 { grid-template-columns: 1fr 1fr; }
}
.nav-sep { height: 1px; background: rgba(255, 255, 255, .06); margin: 6px 18px; }
.claim-bottom { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.summary-table th, .summary-table td { padding: 8px 10px !important; }
@media (max-width: 900px) { .claim-bottom { grid-template-columns: 1fr; } }
.panel.no-pad > .table.compact { margin: 0; width: 100%; }
.record-code .badge { font-family: var(--font); }
.stat-value { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value small { font-size: 12px; }

/* Accounting */
.group-row td { font-weight: 600; background: #fafbfc; }
.row-muted td { color: var(--muted); }
.table th.center, .table td.center { text-align: center; }
.filters-6 { grid-template-columns: repeat(5, minmax(0, 1fr)) auto; }
input.invalid, select.invalid { border-color: var(--danger) !important; background: var(--danger-soft) !important; }
.amount-input { font-size: 18px !important; font-weight: 600; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.report-card { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); border-inline-start: 3px solid var(--primary); color: var(--text); }
.report-card:hover { text-decoration: none; border-color: var(--primary); }
.report-card span { color: var(--muted); font-size: 13px; }
@media (max-width: 1100px) { .filters-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-value { direction: ltr; text-align: left; }
[dir=rtl] .stat-value { text-align: right; }

/* Login: 25% form panel + brand image */
.login-page { margin: 0; min-height: 100vh; background: var(--side-bg); }
.login-split { display: flex; min-height: 100vh; }
.login-panel { flex: 0 0 25%; min-width: 340px; background: var(--surface); display: flex; align-items: center; justify-content: center; padding: 32px 28px; box-shadow: 0 0 30px rgba(0, 0, 0, .25); z-index: 1; }
.login-inner { width: 100%; max-width: 340px; }
.login-inner .btn-block { margin-top: 6px; }
.login-foot { margin-top: 28px; font-size: 12px; color: var(--muted); text-align: center; }
.login-hero { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background-color: #141c28;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(135deg, #1b2738 0%, #121a26 100%);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px, 100% 100%; }
.login-hero.has-image { background-size: cover; background-position: center; background-repeat: no-repeat; }
.hero-content { text-align: center; color: #fff; padding: 40px; }
.hero-name { font-size: 56px; font-weight: 700; letter-spacing: .02em; line-height: 1.1; }
.hero-line { width: 90px; height: 4px; background: var(--accent); margin: 22px auto; }
.hero-tag { font-size: 18px; color: #b9c2cf; }
@media (max-width: 900px) {
  .login-split { flex-direction: column; }
  .login-hero { order: -1; flex: 0 0 180px; }
  .hero-name { font-size: 34px; }
  .hero-tag { font-size: 14px; }
  .login-panel { flex: 1; min-width: 0; box-shadow: none; }
}
.auth-title { font-size: 16px; margin: -6px 0 16px; }
.auth-alt { margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.label-row a { font-weight: 400; }
.hp-field { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; opacity: 0; }
.resend-box { margin: -6px 0 14px; }
.login-inner .check { margin: 2px 0 14px; }

/* Phase 5 */
.input-group { display: flex; gap: 6px; }
.input-group input { flex: 1; min-width: 0; }
.input-group select { width: auto; flex: 0 0 auto; }
.form-row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; width: 100%; }
.inline-form .form-row .field, .form-row .field { min-width: 130px; margin-bottom: 0; }
.inline-form .form-row .field.grow, .form-row .field.grow { flex: 1 1 200px; }
.inline-form .form-row .field.w-sm, .form-row .field.w-sm { min-width: 80px; width: 100px; flex: 0 0 100px; }
.att-grid { font-size: 12px; }
.att-grid th, .att-grid td { padding: 4px 3px; text-align: center; min-width: 22px; }
.att-grid td.name, .att-grid th.name { text-align: start; min-width: 160px; white-space: nowrap; position: sticky; inset-inline-start: 0; background: var(--surface); }
.att-grid .wkend { background: rgba(0,0,0,.035); }
.att-grid .p1 { color: var(--success); font-weight: 600; }
.att-grid .p05 { color: var(--warning); font-weight: 600; }
.log-section { margin-top: 6px; }
.log-section h3 { font-size: 15px; margin: 0 0 10px; }
.grid-table input, .grid-table select { width: 100%; }
.inline-new { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-new select, .inline-new input { width: auto; }
td.clip { max-width: 340px; }
.search input[type=date], .search input[type=month] { width: 160px; }
.grid-actions { padding: 10px 14px; border-top: 1px solid var(--border); }
.emp-cell { min-width: 190px; }
.search .check { white-space: nowrap; }
#payGrid input.num-input { min-width: 90px; }
.tender-grid .col-rate { width: 92px; }
.tender-grid td.f-description, .tender-grid .f-description { min-width: 220px; }
.tender-grid tr.is-section input, .tender-grid tr.is-section td { font-weight: 600; background: #f7f8fa; }
.cc-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; min-width: 80px; }
.cc-bar span { display: block; height: 100%; background: var(--primary); }
.cc-bar.over span { background: var(--danger); }
.cc-bar.warn span { background: var(--warning); }
.kpi-good { color: var(--success); }
.kpi-bad { color: var(--danger); }
.rep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; align-items: start; }
.rep-grid .panel { margin-bottom: 0; }
.rep-list { list-style: none; margin: 0; padding: 0; }
.rep-list li { border-bottom: 1px solid var(--border); }
.rep-list li:last-child { border-bottom: 0; }
.rep-list a { display: block; padding: 9px 2px; color: var(--text); text-decoration: none; }
.rep-list a:hover { color: var(--primary); }
@media print {
  .sidebar, .topbar, .no-print, .tabs, .menu-btn { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; }
  .panel { box-shadow: none; border: 1px solid #ccc; }
}
a.stat-link { color: inherit; text-decoration: none; display: block; }
a.stat-link:hover { border-color: var(--primary); }
.field > span .quick-add { font-weight: 400; font-size: 12px; margin-inline-start: 10px; color: var(--primary); text-decoration: none; }
.field > span .quick-add:hover { text-decoration: underline; }
input.is-loading { background-image: linear-gradient(90deg, transparent, rgba(196,122,23,.12), transparent); background-size: 200% 100%; animation: trload 1s linear infinite; }
@keyframes trload { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.pad-form { padding: 4px 18px 16px; }
input[readonly] { background: #f6f7f9; color: #5a6270; }
/* Sidebar groups */
.nav-group { border-top: 1px solid rgba(255, 255, 255, .05); }
.nav-group-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 18px; background: none; border: 0; border-inline-start: 3px solid transparent; color: var(--side-text); font: inherit; cursor: pointer; text-align: start; }
.nav-group-btn:hover { color: #fff; background: rgba(255, 255, 255, .04); }
.nav-group.has-active > .nav-group-btn { color: #fff; }
.nav-group .chev { width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .15s; flex: none; opacity: .7; }
.nav-group.open .chev { transform: rotate(-135deg); }
.nav-group-items { display: none; padding-bottom: 6px; }
.nav-group.open .nav-group-items { display: block; }
.nav-group-items a { padding-inline-start: 34px; font-size: 13.5px; }
.nav > a + a, .nav > .nav-group + a { border-top: 1px solid rgba(255, 255, 255, .05); }
.nav > a { padding-top: 10px; padding-bottom: 10px; }

/* ===== Sidebar v2 ===== */
.sidebar { display: flex; flex-direction: column; background: linear-gradient(180deg, #1a2536 0%, #121a26 55%, #0e1520 100%); }
.sidebar-brand { gap: 12px; padding: 18px 16px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.brand-mark { width: 38px; height: 38px; flex: none; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; color: #1a1205; background: linear-gradient(135deg, #f0b45a 0%, #c47a17 100%); box-shadow: 0 6px 16px rgba(196, 122, 23, .35); }
.sidebar-brand img { width: 38px; height: 38px; border-radius: 11px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.brand-text b { font-size: 14.5px; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small { font-size: 11.5px; font-weight: 400; color: #8f9bab; }
.nav { flex: 1; padding: 12px 10px 18px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.nav > a, .nav-group-btn { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; margin: 2px 0; border-radius: 10px; border: 0; border-inline-start: 0; color: #c3ccd8; font: inherit; font-size: 14px; background: transparent; cursor: pointer; text-align: start; transition: background .15s, color .15s; }
.nav > a + a, .nav > .nav-group + a { border-top: 0; }
.nav > a:hover, .nav-group-btn:hover { background: rgba(255, 255, 255, .05); color: #fff; text-decoration: none; }
.nav > a.active { background: linear-gradient(90deg, rgba(196, 122, 23, .22), rgba(196, 122, 23, .08)); color: #fff; box-shadow: inset 0 0 0 1px rgba(240, 180, 90, .18); }
[dir=rtl] .nav > a.active { background: linear-gradient(270deg, rgba(196, 122, 23, .22), rgba(196, 122, 23, .08)); }
.nav > a.active .nav-ico { color: #f0b45a; }
.nav-ico { width: 19px; height: 19px; flex: none; color: #8693a5; transition: color .15s; }
.nav > a:hover .nav-ico, .nav-group-btn:hover .nav-ico { color: #dfe5ee; }
.nav > a span, .nav-group-btn span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group { border-top: 0; margin: 2px 0; border-radius: 12px; transition: background .2s; }
.nav-group.open { background: rgba(255, 255, 255, .025); }
.nav-group.has-active > .nav-group-btn { color: #fff; }
.nav-group.has-active > .nav-group-btn .nav-ico { color: #f0b45a; }
.nav-group .chev { width: 6px; height: 6px; opacity: .55; margin-inline-start: 4px; }
.nav-group-items { position: relative; padding: 2px 0 8px; margin-inline-start: 21px; }
.nav-group-items::before { content: ""; position: absolute; top: 2px; bottom: 10px; inset-inline-start: 0; width: 1px; background: rgba(255, 255, 255, .09); }
.nav-group-items a { position: relative; display: block; padding: 7px 14px; padding-inline-start: 18px; margin: 1px 0; margin-inline-end: 6px; border-radius: 8px; border: 0; font-size: 13.5px; color: #a9b4c2; }
.nav-group-items a::before { content: ""; position: absolute; inset-inline-start: -3px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #121a26; border: 1px solid rgba(255, 255, 255, .18); transition: all .15s; }
.nav-group-items a:hover { color: #fff; background: rgba(255, 255, 255, .04); text-decoration: none; }
.nav-group-items a.active { color: #fff; background: rgba(196, 122, 23, .14); }
.nav-group-items a.active::before { background: #f0b45a; border-color: #f0b45a; box-shadow: 0 0 0 3px rgba(240, 180, 90, .18); }
.nav-group-items a span { display: inline; }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin: 0 10px 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .05); }
.sidebar-user .avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #2f6f9f, #1e4a72); }
.sidebar-user .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sidebar-user b { font-size: 13px; color: #e8edf3; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { font-size: 11px; color: #8f9bab; }
.auth-forgot { text-align: center; margin-top: 14px; }
.auth-forgot a { color: var(--accent); font-weight: 500; }
/* Subscription plans */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; margin-bottom: 18px; }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(196, 122, 23, .12); }
.plan-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan-head h3 { font-size: 18px; margin: 0; }
.plan-price b { font-size: 26px; font-variant-numeric: tabular-nums; }
.plan-price b.contact { font-size: 17px; color: var(--muted); }
.plan-price span { color: var(--muted); font-size: 13px; }
.plan-limits, .plan-mods { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.plan-limits li { font-weight: 600; }
.plan-mods { flex: 1; padding-top: 12px; border-top: 1px solid var(--border); }
.plan-mods li { position: relative; padding-inline-start: 18px; color: var(--text); }
.plan-mods li::before { content: ""; position: absolute; inset-inline-start: 2px; top: 6px; width: 8px; height: 4px; border-left: 2px solid var(--success); border-bottom: 2px solid var(--success); transform: rotate(-45deg); }
.plan-form { display: flex; flex-direction: column; gap: 8px; }
.sub-pending { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-inline-start: 4px solid var(--warning); }
.req-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.req-actions input[type=date] { width: 150px; }
.req-actions input[name=reply] { flex: 1 1 140px; }
.row-btns { display: flex; gap: 6px; }
.nav-count { font-style: normal; font-size: 11px; font-weight: 700; background: #f0b45a; color: #1a1205; border-radius: 999px; padding: 1px 7px; }
.receipt-box .receipt-state { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.pay-info { border-inline-start: 4px solid var(--primary); }
.pay-info h3 { margin: 0 0 8px; font-size: 15px; }
.file-pick { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.file-pick input { font-size: 12.5px; }
.receipt-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.receipt-thumb:hover img { box-shadow: 0 0 0 2px var(--accent); }

/* platform revenue */
.stat-hero { background: linear-gradient(135deg, var(--primary, #1e4a72), #2c6a9c); color: #fff; border: 0; }
.stat-hero .stat-label, .stat-hero .stat-sub, .stat-hero .stat-value small { color: rgba(255,255,255,.8); }
.pkg-breakdown { display: flex; flex-wrap: wrap; gap: 10px; margin: -4px 0 18px; }
.pkg-chip { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; min-width: 170px; background: var(--surface, #fff); border: 1px solid var(--border, #e3e7ee); border-radius: 10px; color: inherit; text-decoration: none; font-size: 13px; }
.pkg-chip:hover { border-color: var(--primary, #1e4a72); }
.pkg-chip.active { border-color: var(--primary, #1e4a72); box-shadow: 0 0 0 2px rgba(30,74,114,.12); }
.pkg-chip span { color: var(--muted); font-size: 12px; }
.pkg-chip .pkg-mrr { color: var(--text, #1b2430); font-weight: 600; }
a.stat-hero { text-decoration: none; }

/* most popular plan */
.plan { position: relative; }
.plan.featured { border: 2px solid var(--accent); box-shadow: 0 12px 30px rgba(196, 122, 23, .18); transform: translateY(-6px); padding-top: 30px; }
.plan-ribbon { position: absolute; top: -13px; inset-inline-start: 50%; transform: translateX(50%); background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 600; padding: 4px 16px; border-radius: 999px; white-space: nowrap; box-shadow: 0 4px 10px rgba(196, 122, 23, .3); }
[dir="ltr"] .plan-ribbon { transform: translateX(-50%); }
.plans { padding-top: 18px; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(.95); color: #fff; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* subscription link in the sidebar */
.nav > a.nav-premium { position: relative; margin: 6px 0; color: #f6d79b; background: linear-gradient(100deg, rgba(240, 180, 90, .16), rgba(240, 180, 90, .04)); box-shadow: inset 0 0 0 1px rgba(240, 180, 90, .32); overflow: hidden; }
.nav > a.nav-premium .nav-ico { color: #f0b45a; filter: drop-shadow(0 0 4px rgba(240, 180, 90, .55)); animation: gem-glow 2.8s ease-in-out infinite; }
.nav > a.nav-premium::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; inset-inline-start: -60%; background: linear-gradient(90deg, transparent, rgba(255, 230, 180, .16), transparent); animation: gem-shine 4.5s ease-in-out infinite; pointer-events: none; }
.nav > a.nav-premium:hover, .nav > a.nav-premium.active { color: #fff; background: linear-gradient(100deg, rgba(240, 180, 90, .3), rgba(240, 180, 90, .1)); box-shadow: inset 0 0 0 1px rgba(240, 180, 90, .55); }
@keyframes gem-glow { 0%, 100% { filter: drop-shadow(0 0 2px rgba(240, 180, 90, .35)); } 50% { filter: drop-shadow(0 0 7px rgba(240, 180, 90, .85)); } }
@keyframes gem-shine { 0%, 60% { inset-inline-start: -60%; } 100% { inset-inline-start: 130%; } }
@media (prefers-reduced-motion: reduce) { .nav > a.nav-premium .nav-ico, .nav > a.nav-premium::after { animation: none; } }

/* WhatsApp support button on the login page */
.wa-btn { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; max-width: 380px; margin: 14px auto 0; padding: 11px 16px; border-radius: 10px; background: #25d366; color: #fff; font-weight: 600; font-size: 14.5px; text-decoration: none; box-shadow: 0 6px 18px rgba(37, 211, 102, .3); transition: background .15s, transform .15s; }
.wa-btn:hover { background: #1ebe5b; color: #fff; text-decoration: none; transform: translateY(-1px); }
.wa-btn svg { width: 22px; height: 22px; flex: none; }

/* product logo on auth pages */
.auth-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.auth-logo { max-height: 64px; max-width: 220px; object-fit: contain; }
.auth-head { align-items: flex-end; }
.logo-pick { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-pick img { height: 48px; max-width: 160px; object-fit: contain; background: #f4f6f9; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }

/* password show / hide */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap input { width: 100%; padding-inline-end: 40px; }
.pw-toggle { position: absolute; top: 50%; inset-inline-end: 6px; transform: translateY(-50%); width: 30px; height: 30px; padding: 5px;
  display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.pw-toggle:hover, .pw-toggle:focus-visible { color: var(--primary); background: var(--primary-soft); outline: none; }
.pw-toggle svg { width: 18px; height: 18px; }

/* attendance */
.steps-list { margin: 0 0 10px; padding-inline-start: 20px; line-height: 2; }
.code-box { background: #f4f6f9; border: 1px solid #e3e7ee; border-radius: 6px; padding: 10px 12px; font-size: 12px; overflow-x: auto; white-space: pre; }
.att-grid { font-size: 12px; }
.att-grid th, .att-grid td { padding: 4px 3px; text-align: center; min-width: 24px; }
.att-grid td.emp, .att-grid th.emp { text-align: start; min-width: 160px; white-space: nowrap; position: sticky; inset-inline-start: 0; background: #fff; z-index: 1; }
.att-grid .wkd { color: #98a2b3; }
.att-c { display: inline-block; min-width: 20px; padding: 1px 3px; border-radius: 4px; font-weight: 600; text-decoration: none; }
.att-P { background: #e6f4ea; color: #1e7b3a; }
.att-A { background: #fde8e8; color: #b42318; }
.att-I { background: #fff4e0; color: #b45309; }
.att-W, .att-H { background: #f2f4f7; color: #667085; }
.att-L, .att-S, .att-M { background: #e8eff6; color: #1e4a72; }
.att-late { box-shadow: inset 0 -2px 0 #f59e0b; }
.table-scroll { overflow-x: auto; }
.tree-tg { border: 0; background: transparent; cursor: pointer; width: 18px; padding: 0; color: var(--muted); font-size: 11px; margin-inline-end: 2px; }
.tree-sp { display: inline-block; width: 20px; }

/* accounting: footer row of a panel, budget grid, opening balances */
.panel-foot { padding: 12px 16px; border-top: 1px solid var(--border); margin: 0; }
.bud-grid input { width: 92px !important; min-width: 0; padding: 4px 6px; text-align: end; font-size: 12.5px; }
.bud-grid td, .bud-grid th { padding: 4px 5px; white-space: nowrap; }
.bud-grid .acc { position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; min-width: 210px; white-space: normal; }
.bud-grid tr.group-row .acc { background: var(--bg); }
.ob-table input { width: 130px !important; text-align: end; }
.var-neg { color: var(--danger, #b42318); }
.var-pos { color: var(--success); }

/* sidebar: larger text, sub-headings inside groups */
.sidebar { width: 270px; }
.nav > a, .nav-group-btn { font-size: 17px; padding: 11px 12px; gap: 12px; }
.nav-group-items a { font-size: 16px; padding-top: 9px; padding-bottom: 9px; }
.nav-ico { width: 22px; height: 22px; }
.nav-sub { margin: 10px 6px 4px; margin-inline-start: 18px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .07); font-size: 13px; font-weight: 600; letter-spacing: .2px; color: #7f8b9c; }
.sidebar-user b { font-size: 15px; }
.sidebar-user small { font-size: 13px; }
.sidebar-brand .brand-text b { font-size: 17px; }
.sidebar-brand .brand-text small { font-size: 13px; }

/* login header: centered logo with the app name under it */
.auth-head { position: relative; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding-top: 6px; }
.auth-brand { align-items: center; text-align: center; gap: 12px; width: 100%; }
.auth-logo { max-height: 140px; max-width: 300px; margin: 0 auto; }
.auth-brand h2 { font-size: 24px; margin: 0; }
.auth-head .lang-switch { position: absolute; top: 0; inset-inline-end: 0; }
