html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  overflow-x: hidden;
}

img, svg, canvas { max-width: 100%; }
.content-wrapper { min-width: 0; }
.content-wrapper :where(p, .card-title, .card-text, .alert, .dropdown-item, label, dd) {
  overflow-wrap: anywhere;
}
.content-wrapper .row > * { min-width: 0; }
.form-control, .form-select, .select2-container { max-width: 100%; }
textarea.form-control { min-height: 7rem; }
.modal-dialog {
  max-width: min(var(--bs-modal-width, 500px), calc(100vw - 1rem));
  margin-right: auto;
  margin-left: auto;
}
.mobile-table-card .mobile-cell-label { display: none; }
.mobile-table-card .mobile-cell-value { display: contents; }

.mobile-data-grid-wrap,
.mobile-report-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-data-grid,
.mobile-report-table {
  overflow-wrap: normal;
  word-break: normal;
}

.previous-attendance-details {
  display: grid;
  grid-template-columns: auto minmax(12rem, 1fr) auto;
  gap: .5rem 1.5rem;
  min-width: 0;
}
.previous-attendance-details > div { min-width: 0; }
.previous-attendance-details dt {
  color: var(--bs-secondary-color);
  font-size: .78rem;
}
.previous-attendance-details dd {
  margin: 0;
  font-weight: 600;
}
.previous-attendance-project {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.previous-attendance-action { flex: 0 0 auto; }

@media (max-width: 991.98px) {
  .navbar { min-height: 60px; }
  .navbar > .container-fluid { align-items: center; }
  .navbar-brand {
    max-width: calc(100vw - 86px);
    margin-left: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1rem;
  }
  .navbar-toggler { width: 46px; min-height: 46px; }
  #mainNavbar {
    max-height: calc(100dvh - 68px);
    margin: .6rem -.75rem -.5rem;
    padding: .35rem .75rem 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-top: 1px solid rgba(255,255,255,.15);
  }
  #mainNavbar .navbar-nav { flex-wrap: nowrap; }
  #mainNavbar .nav-link, #mainNavbar .dropdown-item {
    display: flex;
    align-items: center;
    min-height: 46px;
    white-space: normal;
  }
  #mainNavbar .dropdown-toggle { justify-content: space-between; }
  #mainNavbar .dropdown-toggle::after {
    margin-right: auto;
    margin-left: .25rem;
  }
  #mainNavbar .dropdown-menu {
    position: static !important;
    width: 100%;
    min-width: 0;
    max-height: none;
    margin: 0 0 .4rem;
    padding: .25rem;
    transform: none !important;
    border: 0;
    border-radius: .5rem;
    background: rgba(255,255,255,.08);
  }
  #mainNavbar .dropdown-item {
    padding: .6rem .85rem;
    color: rgba(255,255,255,.88);
    border-radius: .35rem;
  }
  #mainNavbar .dropdown-item:hover,
  #mainNavbar .dropdown-item:focus,
  #mainNavbar .dropdown-item.active {
    color: #fff;
    background: rgba(255,255,255,.14);
  }
  #mainNavbar .user-box {
    width: 100%;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid rgba(255,255,255,.15);
  }
}

@media (max-width: 767.98px) {
  html { font-size: 15px; }
  body { margin-bottom: 0; }
  .content-wrapper {
    width: 100%;
    padding: .85rem .65rem 5rem;
  }
  .content-wrapper h1, .content-wrapper .h1 { font-size: 1.55rem; }
  .content-wrapper h2, .content-wrapper .h2 { font-size: 1.3rem; }
  .content-wrapper > .d-flex,
  .content-wrapper .card-header.d-flex {
    flex-wrap: wrap;
    gap: .5rem;
  }
  .btn:not(.btn-close), button:not(.btn-close),
  input[type="button"], input[type="submit"] { min-height: 44px; }
  .btn-sm {
    min-height: 40px;
    padding: .45rem .7rem;
    font-size: .9rem;
  }
  .content-wrapper form .d-flex,
  .content-wrapper .btn-group.mobile-stack,
  .content-wrapper .mobile-action-group { flex-wrap: wrap; }
  .content-wrapper form .d-flex > .form-control,
  .content-wrapper form .d-flex > .form-select {
    flex: 1 1 12rem;
    min-width: 0 !important;
  }
  .modal-dialog { width: auto; margin: .5rem; }
  .modal-content { max-height: calc(100dvh - 1rem); }
  .modal-body { overflow-y: auto; }
  .select2-container .select2-selection--single { min-height: 44px; }
  .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 42px; }
  .select2-container--default .select2-selection--single .select2-selection__arrow { height: 42px; }

  .previous-attendance .card-body { padding: .8rem; }
  .previous-attendance-details {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    gap: .65rem;
  }
  .previous-attendance-details > div {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    gap: .5rem;
  }
  .previous-attendance-action,
  .previous-attendance-action .btn { width: 100%; }

  .attendance-mobile-cards td::before {
    content: attr(data-mobile-label);
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    color: #667085;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.5;
  }
  .attendance-mobile-cards td > * { grid-column: 2; }
  .attendance-mobile-cards .select2-container { width: 100% !important; }
  .attendance-mobile-cards .attendance-checkbox { justify-self: start; }

  .mobile-table-card {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0;
    border: 0;
    background: transparent;
  }
  .mobile-table-card colgroup, .mobile-table-card thead { display: none; }
  .mobile-table-card tbody, .mobile-table-card tfoot {
    display: grid;
    gap: .75rem;
    width: 100%;
  }
  .mobile-table-card tr {
    display: grid;
    grid-template-columns: minmax(0,1fr);
    width: 100%;
    padding: .35rem .75rem;
    overflow: hidden;
    border: 1px solid #d9dee5;
    border-radius: .75rem;
    background: #fff;
    box-shadow: 0 .15rem .45rem rgba(16,24,40,.07);
  }
  .mobile-table-card td, .mobile-table-card th[scope="row"] {
    display: grid;
    grid-template-columns: minmax(7.5rem,38%) minmax(0,1fr);
    align-items: start;
    gap: .65rem;
    width: 100% !important;
    min-width: 0 !important;
    padding: .55rem 0 !important;
    text-align: start !important;
    white-space: normal !important;
    border: 0 !important;
    border-bottom: 1px solid #edf0f3 !important;
  }
  .mobile-table-card td:last-child,
  .mobile-table-card th[scope="row"]:last-child { border-bottom: 0 !important; }
  .mobile-table-card .mobile-cell-label {
    display: block;
    color: #667085;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.5;
  }
  .mobile-table-card .mobile-cell-value { display: block; min-width: 0; }
  .mobile-table-card td[data-mobile-actions="true"] {
    display: flex;
    flex-wrap: wrap;
    grid-template-columns: none;
    gap: .45rem;
    padding-top: .75rem !important;
  }
  .mobile-table-card td[data-mobile-actions="true"] .mobile-cell-label { flex-basis: 100%; }
  .mobile-table-card td[data-mobile-actions="true"] .mobile-cell-value {
    display: flex;
    flex: 1 1 100%;
    flex-wrap: wrap;
    gap: .4rem;
  }
  .mobile-table-card td[data-mobile-actions="true"] form {
    display: inline-flex;
    max-width: 100%;
  }
  .mobile-table-card input, .mobile-table-card select,
  .mobile-table-card textarea {
    min-width: 0 !important;
    max-width: 100%;
  }
  .table-responsive:has(> .mobile-table-card) { overflow: visible; }
  .mobile-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-data-grid-wrap {
    position: relative;
    max-height: calc(100dvh - 12rem);
    overflow: auto;
    border: 1px solid #cfd5dc;
    border-radius: .5rem;
    background: #fff;
  }
  .mobile-data-grid {
    width: max-content !important;
    min-width: 790px !important;
    margin: 0;
    font-size: .75rem;
    line-height: 1.2;
  }
  .mobile-data-grid th,
  .mobile-data-grid td {
    min-width: 0;
    padding: .25rem .3rem !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    white-space: nowrap;
  }
  .mobile-data-grid thead th {
    position: sticky;
    z-index: 4;
    top: 0;
    background: #212529;
    color: #fff;
    box-shadow: 0 1px 0 #495057;
  }
  .mobile-data-grid th:first-child,
  .mobile-data-grid td:first-child {
    position: sticky;
    z-index: 3;
    right: 0;
    min-width: 9rem;
    max-width: 11rem;
    white-space: normal;
    background: #fff;
    box-shadow: -2px 0 3px rgba(16,24,40,.12);
  }
  .mobile-data-grid thead th:first-child {
    z-index: 5;
    background: #212529;
  }
  .mobile-data-grid tr.table-warning td:first-child { background: var(--bs-warning-bg-subtle, #fff3cd); }
  .mobile-data-grid .form-control,
  .mobile-data-grid .form-select,
  .mobile-data-grid .select2-container .select2-selection--single {
    min-height: 34px;
    height: 34px;
    padding-top: .2rem;
    padding-bottom: .2rem;
    font-size: .75rem;
  }
  .mobile-data-grid .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 32px;
  }
  .mobile-data-grid .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 32px;
  }
  .mobile-data-grid .attendance-checkbox {
    width: 24px !important;
    height: 24px !important;
  }

  /* Attendance uses a dense, locally scrollable spreadsheet grid on phones. */
  body[data-controller="Attendance"][data-action="Index"] .attendance-page {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: .75rem !important;
    padding-inline: 0;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-page :where(.card, form, .row, [class*="col-"], .table-responsive) {
    max-width: 100%;
    min-width: 0;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-table-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 10rem);
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #cfd5dc;
    border-radius: .4rem;
    background: #fff;
    direction: rtl;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid {
    width: 34rem !important;
    min-width: 34rem !important;
    margin: 0;
    table-layout: fixed;
    font-size: .72rem;
    line-height: 1.15;
    direction: rtl;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid th,
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid td {
    height: 38px;
    padding: .18rem .25rem !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    direction: rtl;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid thead th {
    position: sticky;
    z-index: 4;
    top: 0;
    background: #212529;
    color: #fff;
    box-shadow: 0 1px 0 #495057;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid th:first-child,
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid td:first-child {
    position: sticky;
    z-index: 3;
    right: 0;
    width: 7rem;
    min-width: 7rem;
    max-width: 7rem;
    background: #fff;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid thead th:first-child {
    z-index: 5;
    background: #212529;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid tr.table-warning td:first-child {
    background: var(--bs-warning-bg-subtle, #fff3cd);
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-worker-col { width: 7rem; }
  body[data-controller="Attendance"][data-action="Index"] .attendance-department-col { width: 5.5rem; }
  body[data-controller="Attendance"][data-action="Index"] .attendance-project-col { width: 7rem; }
  body[data-controller="Attendance"][data-action="Index"] .attendance-present-col { width: 3.5rem; }
  body[data-controller="Attendance"][data-action="Index"] .attendance-overtime-col { width: 4rem; }
  body[data-controller="Attendance"][data-action="Index"] .attendance-notes-col { width: 7rem; }
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid :where(.form-control, .form-select) {
    min-height: 30px;
    height: 30px;
    padding: .1rem .35rem;
    font-size: .72rem;
    line-height: 1.1;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid .select2-container {
    width: 100% !important;
    min-width: 0;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid .select2-selection--single {
    min-height: 30px;
    height: 30px;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid .select2-selection__rendered {
    padding-inline: .25rem 1.25rem;
    line-height: 28px;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid .select2-selection__arrow {
    height: 28px;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-compact-grid .attendance-checkbox {
    width: 24px !important;
    height: 24px !important;
    margin: 0;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-worker-cell .badge {
    padding: .18em .35em;
    font-size: .62rem;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-registration-time {
    display: none;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-page .row > [class*="col-"] > :where(.btn, button),
  body[data-controller="Attendance"][data-action="Index"] #saveAttendanceButton {
    width: 100%;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-page :where(.btn, button, .form-control, .form-select) {
    min-height: 44px;
  }
  body[data-controller="Attendance"][data-action="Index"] .attendance-page :where(.badge, dd, .btn, label) {
    overflow-wrap: anywhere;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-toolbar {
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-toolbar h2 {
    margin-bottom: 0;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-toolbar-actions {
    flex-wrap: wrap;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-toolbar-actions .btn {
    min-height: 34px;
    padding: .3rem .55rem;
    font-size: .8rem;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-filters {
    padding: .6rem;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-filters .form-label {
    margin-bottom: .2rem;
    font-size: .78rem;
    font-weight: 700;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-filters .form-select,
  body[data-controller="Employees"][data-action="Index"] .employees-filters .btn {
    min-height: 36px;
    padding-top: .3rem;
    padding-bottom: .3rem;
    font-size: .8rem;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-table-wrap {
    position: relative;
    max-height: calc(100dvh - 10.5rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    border: 1px solid #cfd5dc;
    border-radius: .5rem;
    background: #fff;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-table {
    width: max-content !important;
    min-width: 760px !important;
    margin: 0;
    font-size: .72rem;
    line-height: 1.2;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-table th,
  body[data-controller="Employees"][data-action="Index"] .employees-table td {
    padding: .22rem .3rem !important;
    height: 31px;
    vertical-align: middle;
    overflow-wrap: normal !important;
    word-break: normal !important;
    white-space: nowrap;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-table thead th {
    position: sticky;
    z-index: 4;
    top: 0;
    background: #212529;
    color: #fff;
    box-shadow: 0 1px 0 #495057;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-table th:first-child,
  body[data-controller="Employees"][data-action="Index"] .employees-table td:first-child {
    position: sticky;
    z-index: 3;
    right: 0;
    min-width: 3.25rem;
    max-width: 3.25rem;
    white-space: nowrap;
    background: #fff;
    box-shadow: -2px 0 3px rgba(16,24,40,.12);
  }
  body[data-controller="Employees"][data-action="Index"] .employees-table thead th:first-child {
    z-index: 5;
    background: #212529;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-table .badge {
    padding: .25em .45em;
    font-size: .68rem;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-row-actions {
    min-width: 7.25rem;
    white-space: nowrap;
  }
  body[data-controller="Employees"][data-action="Index"] .employees-row-actions .btn-sm {
    min-height: 26px;
    padding: .18rem .38rem;
    font-size: .7rem;
    line-height: 1.2;
  }
  .mobile-report-scroll,
  body[data-controller="FinancialCommandCenter"] .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-report-table,
  body[data-controller="FinancialCommandCenter"] .table-responsive > table {
    width: max-content !important;
    min-width: 680px;
    table-layout: auto;
  }
  .mobile-report-table th,
  .mobile-report-table td,
  body[data-controller="FinancialCommandCenter"] table th,
  body[data-controller="FinancialCommandCenter"] table td {
    overflow-wrap: normal !important;
    word-break: normal !important;
    white-space: normal;
  }
  body[data-controller="FinancialCommandCenter"] table .amount,
  body[data-controller="FinancialCommandCenter"] table td:has(> .fcc-value) {
    white-space: nowrap;
  }
  .mobile-sticky-actions {
    position: sticky;
    z-index: 1010;
    bottom: .5rem;
    padding: .5rem;
    border: 1px solid #d9dee5;
    border-radius: .75rem;
    background: rgba(255,255,255,.96);
    box-shadow: 0 -.2rem .8rem rgba(16,24,40,.12);
    backdrop-filter: blur(5px);
  }
  footer { padding: .75rem; font-size: .8rem; }
}

/* Subcontractor statements: high-volume Excel-like list on every viewport. */
.subcontractor-filter-panel {
  padding: .8rem;
  border: 1px solid #d8dde3;
  border-radius: .4rem;
  background: #f8f9fa;
}
.subcontractor-sheet-hint {
  padding: .35rem .55rem;
  color: #5d6673;
  background: #eef3f8;
  border: 1px solid #d8e2ec;
  border-bottom: 0;
  font-size: .75rem;
}
.subcontractor-sheet-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #cfd6de;
  border-radius: .35rem;
  direction: rtl;
  -webkit-overflow-scrolling: touch;
}
.subcontractor-sheet {
  width: 100%;
  min-width: 76rem;
  table-layout: fixed;
  direction: rtl;
  font-size: .78rem;
}
.subcontractor-sheet th,
.subcontractor-sheet td {
  height: 42px;
  padding: .25rem .4rem !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.subcontractor-sheet thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #212529;
  color: #fff;
  text-align: center;
}
.subcontractor-sheet th:first-child,
.subcontractor-sheet td:first-child {
  position: sticky;
  right: 0;
  z-index: 3;
  width: 9rem;
  min-width: 9rem;
  max-width: 9rem;
  background: #fff;
  box-shadow: -2px 0 3px rgba(16, 24, 40, .1);
}
.subcontractor-sheet th:last-child,
.subcontractor-sheet td:last-child {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 10.5rem;
  min-width: 10.5rem;
  max-width: 10.5rem;
  background: #fff;
  box-shadow: 2px 0 3px rgba(16, 24, 40, .1);
}
.subcontractor-sheet thead th:first-child,
.subcontractor-sheet thead th:last-child {
  z-index: 5;
  background: #212529;
}
.subcontractor-sheet.table-striped > tbody > tr:nth-of-type(odd) > td:first-child,
.subcontractor-sheet.table-striped > tbody > tr:nth-of-type(odd) > td:last-child {
  background: #f2f2f2;
}
.subcontractor-sheet tfoot th {
  background: #e9ecef;
  font-weight: 700;
}
.subcontractor-sheet-actions { text-align: center; }
.subcontractor-sheet-actions form { display: inline-block; }
.subcontractor-sheet-actions .btn {
  min-height: 32px;
  padding: .15rem .4rem;
  font-size: .72rem;
}

@media (max-width: 767.98px) {
  .subcontractor-filter-panel { padding: .7rem; }
  .subcontractor-filter-panel .form-control,
  .subcontractor-filter-panel .form-select,
  .subcontractor-filter-panel .btn { min-height: 46px; }
  .subcontractor-sheet { min-width: 70rem; font-size: .72rem; }
  .subcontractor-sheet th,
  .subcontractor-sheet td { height: 40px; padding: .2rem .3rem !important; }
  .subcontractor-statements-page .pagination { flex-wrap: wrap; }
  .subcontractor-statements-page .page-link {
    min-width: 42px;
    min-height: 42px;
    display: grid;
    place-items: center;
  }
}

@media (max-width: 389.98px) {
  .mobile-table-card td, .mobile-table-card th[scope="row"] {
    grid-template-columns: minmax(6.5rem,36%) minmax(0,1fr);
    gap: .45rem;
  }
  .content-wrapper { padding-right: .5rem; padding-left: .5rem; }
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Site Operations is field-first: touch targets and essential data are optimized for phones. */
.siteops-page-header,
.siteops-header-actions,
.siteops-export-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  flex-wrap: wrap;
}
.siteops-header-actions,
.siteops-export-actions { justify-content: flex-end; }
.siteops-form-page { max-width: 760px; }
.siteops-entry-form .form-control,
.siteops-entry-form .form-select,
.siteops-filter-form .form-control,
.siteops-filter-form .form-select { min-height: 46px; }
.siteops-entry-form textarea.form-control { min-height: 6rem; }
.siteops-balance-card { padding: 1rem; min-height: 9.5rem; justify-content: center; }
.siteops-stat-card { height: 100%; min-height: 7rem; padding: .9rem .45rem; justify-content: center; }
.siteops-stat-card strong { display: block; margin-top: .3rem; font-size: 1.5rem; }
.siteops-current-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #9bd2ae;
  border-radius: .75rem;
  background: #eaf8ef;
  color: #135c2c;
  font-size: 1.05rem;
}
.siteops-current-balance strong { font-size: 1.45rem; white-space: nowrap; }
.siteops-receipt-card,
.siteops-report-card,
.siteops-report-link { border-radius: .85rem; box-shadow: 0 .15rem .5rem rgba(16,24,40,.08); }
.siteops-report-link { min-height: 7rem; justify-content: center; gap: .35rem; }
.siteops-report-link strong { font-size: 1.08rem; }
.siteops-receipt-bags { margin: .65rem 0; color: #1f4e78; font-size: 1.8rem; font-weight: 800; }
.siteops-receipt-bags small { font-size: 1rem; font-weight: 600; }
.siteops-details { display: grid; gap: .65rem; margin: 0; }
.siteops-details > div { display: grid; grid-template-columns: minmax(7rem, 32%) minmax(0, 1fr); gap: .65rem; }
.siteops-details dt { color: #667085; font-size: .86rem; }
.siteops-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.siteops-receipt-actions { display: grid; gap: 1rem; margin-top: 1rem; }
.siteops-destructive-action { margin-top: .5rem; padding-top: 1rem; border-top: 1px solid #f0b8bd; }
.siteops-totals { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .65rem; }
.siteops-totals.siteops-totals-four { grid-template-columns: repeat(4,minmax(0,1fr)); }
.siteops-totals > div { padding: .85rem; border: 1px solid #cfe2f3; border-radius: .7rem; background: #eef7ff; }
.siteops-totals span { display: block; color: #566273; font-size: .85rem; }
.siteops-totals strong { display: block; margin-top: .25rem; color: #1f4e78; font-size: 1.25rem; }

/* Site water is a dense operational sheet; horizontal movement stays inside this wrapper. */
.water-page { width: 100%; max-width: 100%; min-width: 0; overflow-x: clip; }
.water-filter-panel { min-width: 0; }
.water-sheet-wrap {
  width: 100%; max-width: 100%; overflow-x: auto; direction: rtl;
  border: 1px solid #d8dde3; border-radius: .45rem; -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}
.water-sheet { width: 100%; min-width: 88rem; margin: 0; table-layout: fixed; direction: rtl; font-size: .78rem; }
.water-sheet th,
.water-sheet td {
  height: 46px; padding: .25rem .4rem !important; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; direction: rtl;
}
.water-sheet thead th { position: sticky; z-index: 4; top: 0; background: #212529; color: #fff; }
.water-sheet th:first-child,
.water-sheet td:first-child {
  position: sticky; z-index: 3; right: 0; width: 7rem; min-width: 7rem; max-width: 7rem;
  background: #fff; box-shadow: -2px 0 3px rgba(16,24,40,.12);
}
.water-sheet thead th:first-child { z-index: 5; background: #212529; }
.water-sheet.table-striped > tbody > tr:nth-of-type(odd) > td:first-child { background: #f2f2f2; }
.water-sheet th:nth-child(2), .water-sheet td:nth-child(2) { width: 12rem; }
.water-sheet th:nth-child(8), .water-sheet td:nth-child(8),
.water-sheet th:nth-child(9), .water-sheet td:nth-child(9) { width: 11rem; }
.water-sheet-actions .btn { min-height: 36px; padding: .25rem .55rem; white-space: nowrap; }
.water-pager {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: .65rem; margin-top: .85rem;
}
.water-pager > .btn { min-width: 5.5rem; }
.water-page-status { min-width: 7rem; text-align: center; font-weight: 600; }
.water-page-size { display: flex; align-items: center; gap: .4rem; margin-inline-start: .75rem; }
.water-page-size .form-select { width: 5rem; }
.water-totals {
  display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .6rem; margin-top: .85rem;
}
.water-totals > div { min-width: 0; padding: .7rem; border: 1px solid #cfe2f3; border-radius: .65rem; background: #eef7ff; }
.water-totals span { display: block; color: #566273; font-size: .8rem; }
.water-totals strong { display: block; margin-top: .2rem; color: #1f4e78; font-size: 1.15rem; white-space: nowrap; }
.water-provider-field .form-control { min-height: 48px; }

/* Cement custody: bounded daily workspace and paged history. */
.cement-daily-page,
.cement-history-page,
.cement-consumption-details { max-width: 100%; min-width: 0; overflow-x: clip; }
.cement-kpi-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .65rem; }
.cement-kpi { min-width: 0; min-height: 6.5rem; padding: .8rem; align-items: center; justify-content: center; text-align: center; }
.cement-kpi span { color: #566273; font-size: .88rem; }
.cement-kpi strong { font-size: 1.55rem; line-height: 1.15; }
.cement-kpi-balance { min-height: 7.5rem; }
.cement-kpi-balance span { color: inherit; font-weight: 700; }
.cement-kpi-balance strong { font-size: 2.6rem; }
.cement-section-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .65rem; }
.cement-sheet-wrap { width: 100%; max-width: 100%; overflow-x: auto; direction: rtl; border: 1px solid #d8dde3; border-radius: .45rem; -webkit-overflow-scrolling: touch; }
.cement-sheet { width: 100%; min-width: 44rem; margin: 0; table-layout: fixed; direction: rtl; font-size: .78rem; }
.cement-sheet th,
.cement-sheet td { height: 46px; padding: .25rem .4rem !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; direction: rtl; }
.cement-sheet thead th { position: sticky; z-index: 4; top: 0; background: #212529; color: #fff; }
.cement-sheet th:first-child,
.cement-sheet td:first-child { position: sticky; z-index: 3; right: 0; width: 7rem; min-width: 7rem; max-width: 7rem; background: #fff; box-shadow: -2px 0 3px rgba(16,24,40,.1); }
.cement-sheet thead th:first-child { z-index: 5; background: #212529; }
.cement-sheet.table-striped > tbody > tr:nth-of-type(odd) > td:first-child { background: #f2f2f2; }
.cement-pending-sheet { min-width: 56rem; }
.cement-pending-sheet th:first-child,
.cement-pending-sheet td:first-child { width: 9rem; min-width: 9rem; max-width: 9rem; }
.cement-consumption-sheet { min-width: 48rem; }
.cement-history-table { min-width: 52rem; }
.cement-sheet-actions { white-space: nowrap; }
.cement-sheet-actions form { display: inline-block; margin: 0 .15rem; }
.cement-sheet-actions .btn,
.cement-details-button { min-width: 42px; min-height: 38px; padding: .2rem .5rem; white-space: nowrap; }
.cement-sheet-form-row td { position: static !important; height: auto; padding: 0 !important; background: #fff8e1 !important; box-shadow: none !important; }
.cement-inline-reason { display: grid; grid-template-columns: auto minmax(12rem,1fr) auto; align-items: center; gap: .5rem; padding: .5rem; }
.cement-inline-reason .form-control,
.cement-inline-reason .btn { min-height: 40px; }
.cement-history-filter-form { padding: .85rem; }
.cement-active-filters { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.cement-consumption-details { max-width: 48rem; }
.cement-void-form .btn { min-height: 48px; }

.home-cement-widget { border: 1px solid #b7dfc4; border-inline-start: .4rem solid #198754; max-width: 62rem; }
.home-cement-balance { background: linear-gradient(135deg,#e8f7ee,#d1eddb); color: #0b5d35; }
.home-cement-balance > span { font-size: 1rem; font-weight: 700; }
.home-cement-balance > strong { font-size: clamp(2.25rem,8vw,3.5rem); line-height: 1.15; }
.home-cement-balance small { font-size: .45em; }
.home-cement-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .75rem; }
.home-cement-stats > div { padding: .75rem; border: 1px solid #e3e6e8; border-radius: .75rem; background: #f8f9fa; text-align: center; }
.home-cement-stats span,
.home-cement-stats strong { display: block; }
.home-cement-stats strong { color: #146c43; font-size: 1.35rem; }
.home-cement-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.home-cement-actions .btn { min-width: 12rem; min-height: 3rem; }

@media (max-width: 767.98px) {
  .siteops-page { padding-right: 0 !important; padding-left: 0 !important; }
  .siteops-page-header { align-items: stretch; }
  .siteops-page-header > h1 { flex: 1 1 100%; }
  .siteops-header-actions,
  .siteops-export-actions { width: 100%; }
  .siteops-header-actions > *,
  .siteops-export-actions > * { flex: 1 1 0; min-height: 48px; }
  .siteops-entry-form,
  .siteops-filter-form { padding: 1rem; }
  .siteops-entry-form .form-control,
  .siteops-entry-form .form-select,
  .siteops-filter-form .form-control,
  .siteops-filter-form .form-select { min-height: 50px; font-size: 1rem; }
  .siteops-balance-card { min-height: 8.5rem; }
  .siteops-stat-card { min-height: 6.7rem; font-size: .86rem; }
  .siteops-current-balance { position: relative; flex-direction: column; align-items: flex-start; }
  .siteops-current-balance strong { font-size: 1.55rem; }
  .siteops-totals,
  .siteops-totals.siteops-totals-four { grid-template-columns: minmax(0,1fr); }
  .water-primary-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); width: 100%; }
  .water-primary-actions > * { width: 100%; min-width: 0; min-height: 46px; padding-inline: .35rem; font-size: .84rem; }
  .water-filter-form { margin-top: .65rem !important; margin-bottom: .65rem !important; padding: .8rem; }
  .water-filter-form .btn { min-height: 46px; }
  .water-sheet { font-size: .72rem; }
  .water-sheet th,
  .water-sheet td { height: 44px; padding: .2rem .3rem !important; }
  .water-sheet-actions .btn { min-width: 42px; min-height: 38px; }
  .water-pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: .45rem; }
  .water-pager > .btn { min-width: 0; min-height: 44px; display: grid; place-items: center; }
  .water-page-status { min-width: 0; white-space: nowrap; font-size: .88rem; }
  .water-page-size { grid-column: 1 / -1; justify-content: center; margin: 0; min-height: 44px; }
  .water-totals { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; }
  .water-totals > div { padding: .55rem; min-height: 4.5rem; }
  .water-totals strong { font-size: 1rem; }
  .water-provider-field .form-control { min-height: 52px; font-size: 1rem; }
  .siteops-receipt-actions form,
  .siteops-receipt-actions a { width: 100%; }
  .siteops-details > div { grid-template-columns: minmax(6.5rem, 36%) minmax(0,1fr); }
  .cement-daily-page,
  .cement-history-page { padding-top: .65rem !important; }
  .cement-kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; }
  .cement-kpi { min-height: 5rem; padding: .55rem .35rem; }
  .cement-kpi strong { font-size: 1.35rem; }
  .cement-kpi-balance { grid-column: 1 / -1; min-height: 6.2rem; }
  .cement-kpi-balance strong { font-size: 2.35rem; }
  .cement-kpi-grid .cement-kpi:last-child { grid-column: 1 / -1; min-height: 4.5rem; }
  .cement-section-heading { align-items: center; }
  .cement-section-heading .btn { min-height: 42px; }
  .cement-sheet { font-size: .72rem; }
  .cement-sheet th,
  .cement-sheet td { height: 44px; padding: .2rem .3rem !important; }
  .cement-inline-reason { grid-template-columns: minmax(0,1fr); }
  .cement-inline-reason label { margin: 0; }
  .cement-history-filter-form { padding: .75rem; }
  .cement-history-page .pagination { flex-wrap: wrap; }
  .cement-history-page .page-link { min-width: 42px; min-height: 42px; display: grid; place-items: center; }
  .cement-filter-toggle { min-height: 46px; min-width: 8rem; }
  .cement-consumption-details-list > div { grid-template-columns: minmax(6rem,35%) minmax(0,1fr); }
  .home-cement-stats { grid-template-columns: minmax(0,1fr); }
  .home-cement-actions { display: grid; grid-template-columns: minmax(0,1fr); }
  .home-cement-actions .btn { width: 100%; min-width: 0; }
}
