/* RMS custom styles — extends ACE admin theme */
.login-brand-logo {
  max-height: 72px;
  max-width: 280px;
  width: auto;
  margin: 12px auto 4px;
  display: block;
  object-fit: contain;
}

.rms-stat-box {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-left: 4px solid #438eb9;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.rms-stat-box .rms-stat-value {
  font-size: 28px;
  font-weight: 600;
  color: #393939;
  line-height: 1.2;
}

.rms-stat-box .rms-stat-label {
  color: #777;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rms-branding-preview {
  max-height: 80px;
  max-width: 240px;
  object-fit: contain;
  border: 1px solid #ddd;
  padding: 8px;
  background: #fff;
}

.rms-table-actions .btn {
  margin-right: 4px;
}

/* POS shell */
.pos-shell {
  min-height: 100vh;
  background: linear-gradient(160deg, #f4f7fa 0%, #e8eef5 50%, #f7f7f7 100%);
}

.pos-topbar {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.pos-topbar img {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.pos-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  padding: 16px;
}

@media (max-width: 992px) {
  .pos-grid { grid-template-columns: 1fr; }
}

.pos-panel {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 2px;
  padding: 14px;
  min-height: 420px;
}

.pos-category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pos-category-chip {
  border: 1px solid #cfd8e3;
  background: #f7f9fc;
  color: #445;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.pos-category-chip:hover {
  border-color: #438eb9;
  color: #438eb9;
}

.pos-category-chip.active {
  background: #438eb9;
  border-color: #438eb9;
  color: #fff;
}

.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  max-height: 540px;
  overflow: auto;
  padding: 2px;
}

.pos-product-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid #9ec3e6;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.pos-product-card:hover {
  border-color: #438eb9;
  box-shadow: 0 4px 12px rgba(67, 142, 185, 0.18);
  transform: translateY(-1px);
}

.pos-product-card-image {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #eef3f8;
  overflow: hidden;
}

/* Absolute fill + contain so full product art is visible (beats ACE/bootstrap img defaults). */
.pos-product-card .pos-product-card-image > img,
button.pos-product-card .pos-product-card-image > img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block;
}

.pos-product-card-name {
  padding: 8px 10px 4px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  line-height: 1.25;
  min-height: 2.5em;
}

.pos-product-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  padding: 0 10px 10px;
}

.pos-product-card-barcode {
  font-size: 12px;
  color: #777;
  word-break: break-all;
}

.pos-product-card-price {
  font-size: 14px;
  color: #222;
  white-space: nowrap;
}

.pos-product-empty {
  color: #888;
  text-align: center;
  padding: 28px 12px;
}

.pos-product-pager {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.pos-product-meta {
  float: left;
  line-height: 30px;
  color: #666;
  font-size: 12px;
}

.pos-cart-total {
  font-size: 26px;
  font-weight: 700;
  color: #2e7d32;
}

body.pos-modal-open {
  overflow: hidden;
}

.pos-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.pos-modal-overlay[hidden] {
  display: none !important;
}

.pos-modal {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
  overflow: hidden;
}

.pos-modal-sm {
  max-width: 380px;
}

.pos-modal-lg {
  max-width: 640px;
}

.pos-camera-scan-stage {
  position: relative;
  background: #111;
  border-radius: 4px;
  overflow: hidden;
  min-height: 280px;
}

.pos-camera-scan-video,
.pos-camera-scan-reader {
  width: 100%;
  display: block;
  background: #111;
}

.pos-camera-scan-video {
  max-height: 420px;
  object-fit: cover;
}

.pos-camera-scan-reader video {
  width: 100% !important;
  border: 0 !important;
}

.pos-camera-insecure-help .alert {
  margin-bottom: 12px;
}

.pos-camera-insecure-panel {
  background: #f9f9f9;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.pos-camera-insecure-steps {
  margin: 0 0 12px 18px;
  padding: 0;
  line-height: 1.55;
}

.pos-camera-insecure-steps li {
  margin-bottom: 8px;
}

.pos-camera-code {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 6px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 12px;
  word-break: break-all;
}

.pos-cart-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.pos-cart-summary {
  line-height: 1.6;
}

.pos-pay-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pos-pay-chip {
  border: 1px solid #cfd8dc;
  background: #f7f9fb;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}

.pos-pay-chip.active {
  border-color: #1976d2;
  background: #e3f2fd;
  color: #0d47a1;
}

.pos-digital-receipt {
  text-align: center;
}

.pos-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e8e8e8;
  background: #f8fafc;
}

.pos-modal-header h4 {
  margin: 0;
  font-size: 18px;
}

.pos-modal-close {
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  color: #777;
  padding: 0 4px;
  cursor: pointer;
}

.pos-modal-body {
  padding: 16px;
}

.pos-modal-footer {
  padding: 12px 16px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid #eee;
}

.pos-pay-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  margin-bottom: 8px;
}

.pos-pay-row[hidden],
.pos-pay-result[hidden] {
  display: none !important;
}

.pos-pay-row strong {
  font-size: 22px;
}

.pos-pay-change {
  color: #2e7d32;
}

.pos-pay-balance {
  color: #c62828;
}

.pos-pay-hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: #666;
}

.pos-pay-hint.is-ok {
  color: #2e7d32;
}

.pos-pay-hint.is-warn {
  color: #c62828;
}

.pos-modal-receipt {
  max-width: 460px;
}

.pos-receipt-actions {
  justify-content: center;
}

.pos-modal-body .pos-receipt {
  margin: 0 auto;
  max-width: 100%;
}

.pos-receipt {
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
  white-space: pre-wrap;
  background: #fff;
  border: 1px dashed #bbb;
  padding: 16px;
  max-width: 360px;
  margin: 0 auto;
}

/* List advanced search + pagination */
.rms-list-toolbar {
  margin-bottom: 14px;
}

.rms-list-quick-form {
  margin-bottom: 8px;
}

.rms-list-quick-form .btn,
.rms-list-quick-form .input-group {
  margin-right: 6px;
  margin-bottom: 6px;
}

.rms-list-filter-form {
  background: #f9f9f9;
  border: 1px solid #e3e3e3;
  padding: 12px 14px;
  margin-top: 8px;
  border-radius: 2px;
}

.rms-list-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px 12px;
  margin-bottom: 12px;
}

.rms-list-filter-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  margin-bottom: 4px;
}

.rms-list-filter-actions .btn {
  margin-right: 6px;
}

.rms-list-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.rms-list-meta {
  line-height: 30px;
  color: #666;
  font-size: 13px;
}

.rms-list-pagination {
  margin-left: 12px;
}

/* Role permission matrix (hierarchical Module / Sub Module × Function) */
.rms-perm-matrix-wrap {
  overflow-x: auto;
  margin-bottom: 12px;
  border: 1px solid #d5d5d5;
  background: #fff;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
}

.rms-perm-matrix {
  margin-bottom: 0;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
}

.rms-perm-matrix > thead > tr > th,
.rms-perm-matrix > tbody > tr > th,
.rms-perm-matrix > tbody > tr > td {
  vertical-align: middle;
  border-color: #d5d5d5 !important;
}

.rms-perm-matrix > thead > tr > th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f3f3f3;
  border-bottom: 2px solid #d5d5d5;
  box-shadow: 0 1px 0 #d5d5d5;
  text-align: center;
  font-size: 12px;
  text-transform: capitalize;
  white-space: nowrap;
}

.rms-perm-matrix-module-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fafafa;
  min-width: 280px;
  max-width: 420px;
  text-align: left !important;
  font-weight: 600;
  color: #393939;
  border-right: 2px solid #d5d5d5 !important;
  white-space: normal;
}

.rms-perm-matrix > thead > tr > th.rms-perm-matrix-module-col {
  z-index: 4;
  background: #f3f3f3;
  white-space: nowrap;
}

.rms-perm-matrix-module-row > th.rms-perm-matrix-module-col,
.rms-perm-matrix-module-row > td {
  background: #e8eef5;
  font-weight: 700;
}

.rms-perm-matrix-module-row > th.rms-perm-matrix-module-col {
  z-index: 2;
}

.rms-perm-matrix-module-name {
  display: inline;
  font-size: 13px;
}

.rms-perm-matrix-sub-col {
  font-weight: normal;
  padding-left: 22px !important;
  background: #fff;
}

.rms-perm-matrix-perm-row.rms-perm-matrix-alt > td {
  background: #f7f7f7;
}

.rms-perm-matrix-perm-row.rms-perm-matrix-alt > td.rms-perm-matrix-module-col {
  background: #f7f7f7;
}

.rms-perm-matrix-perm-label {
  display: block;
  line-height: 1.35;
  color: #393939;
}

.rms-perm-matrix-code {
  color: #d15b47;
  font-size: 11px;
  font-weight: normal;
  white-space: nowrap;
}

.rms-perm-matrix-row-actions,
.rms-perm-matrix-col-actions {
  display: block;
  margin-top: 2px;
  font-weight: normal;
  text-transform: none;
  font-size: 11px;
  line-height: 1.2;
}

.rms-perm-matrix-sep {
  color: #999;
  margin: 0 2px;
}

.rpm-toggle-link {
  color: #337ab7;
  text-decoration: none;
  font-weight: normal;
}

.rpm-toggle-link:hover,
.rpm-toggle-link:focus {
  color: #23527c;
  text-decoration: underline;
}

.rms-perm-matrix-fn-col {
  min-width: 88px;
}

.rms-perm-matrix-count-col {
  min-width: 72px;
  font-size: 12px;
  white-space: nowrap;
}

.rms-perm-matrix-cell {
  text-align: center;
  background: #fff;
  padding: 6px 8px !important;
  white-space: nowrap;
}

.rms-perm-matrix-cell-empty {
  background: #fafafa;
}

.rms-perm-matrix-cell-module {
  background: #e8eef5;
}

.rms-perm-matrix-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-weight: normal;
  cursor: pointer;
}

.rms-perm-matrix-item input[type="checkbox"] {
  margin: 0;
}

.rms-perm-matrix > tbody > tr.rms-perm-matrix-perm-row:hover > td {
  background: #f5f9fc;
}

.rms-perm-matrix > tbody > tr.rms-perm-matrix-perm-row:hover > td.rms-perm-matrix-module-col {
  background: #eef5fa;
}

.rms-perm-matrix > tbody > tr.rms-perm-matrix-module-row:hover > th,
.rms-perm-matrix > tbody > tr.rms-perm-matrix-module-row:hover > td {
  background: #dce6f0;
}

/* Chosen searchable selects (ACE-compatible) */
.form-group .chosen-container {
  width: 100% !important;
}

.form-inline .chosen-container {
  min-width: 220px;
  max-width: 100%;
  margin-right: 6px;
  vertical-align: middle;
}

.form-inline .chosen-container-single .chosen-single {
  height: 34px;
  line-height: 32px;
}

table .chosen-container {
  min-width: 120px;
  max-width: 100%;
}

.chosen-container-single .chosen-single {
  border-radius: 0;
}

.chosen-container .chosen-results {
  max-height: 240px;
}
