/* VAT totals box on the sale form */
.totals-box {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(26, 162, 165, 0.25);
  border-radius: 12px;
  background: rgba(26, 162, 165, 0.05);
}
.totals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.totals-row:last-child { margin-bottom: 0; }
.totals-row span,
.totals-row label { font-weight: 600; color: var(--medium-text); margin: 0; }
.totals-row input {
  width: 150px;
  max-width: 45%;
  text-align: left;
  background: #fff;
  font-weight: 700;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
}
.totals-row.grand span,
.totals-row.grand label { color: var(--primary-color); font-size: 1.1em; font-weight: 800; }
.totals-row.grand input {
  background: #e0f2f1;
  color: var(--primary-color);
  font-size: 1.15em;
  font-weight: 800;
}

/* VAT totals box on the sale form */
.totals-box {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(26, 162, 165, 0.25);
  border-radius: 12px;
  background: rgba(26, 162, 165, 0.05);
}
.totals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.totals-row:last-child { margin-bottom: 0; }
.totals-row span,
.totals-row label { font-weight: 600; color: var(--medium-text); margin: 0; }
.totals-row input {
  width: 150px;
  max-width: 45%;
  text-align: left;
  background: #fff;
  font-weight: 700;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
}
.totals-row.grand span,
.totals-row.grand label { color: var(--primary-color); font-size: 1.1em; font-weight: 800; }
.totals-row.grand input {
  background: #e0f2f1;
  color: var(--primary-color);
  font-size: 1.15em;
  font-weight: 800;
}

/* Saudi Riyal mark — cropped transparent PNG */
.riyal-sign,
img.riyal-sign {
  height: 1.15em !important;
  width: auto !important;
  max-height: 1.2em !important;
  max-width: 1.45em !important;
  vertical-align: -0.22em;
  display: inline-block !important;
  object-fit: contain !important;
  margin-inline-start: 0.12em;
  flex-shrink: 0;
}

.riyal-sign.riyal-lg {
  height: 1.4em !important;
  max-height: 1.45em !important;
}

.riyal-sign.riyal-inline-icon {
  height: 1.2em !important;
  margin: 0;
}

.riyal-glyph {
  font-weight: 800;
  font-size: 0.95em;
  display: inline-block;
  vertical-align: -0.05em;
  margin-inline-start: 0.1em;
}

.btn-primary .riyal-sign,
.btn-quick .riyal-sign {
  filter: brightness(0) invert(1);
}

/* Header title restored */
#erp-header {
  height: auto !important;
  min-height: var(--header-height);
  padding-top: 10px !important;
  padding-bottom: 10px !important;
  display: flex !important;
  align-items: center;
  gap: 12px;
}

#erp-header .header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  margin-inline-end: auto;
}

#erp-header h1,
#header-title {
  display: block !important;
  font-size: 1.4em;
  font-weight: 700;
  margin: 0;
  color: var(--primary-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Quick actions above dashboard cards */
.dashboard-quick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  width: 100%;
}

.btn-quick {
  appearance: none;
  border: none;
  background: #1aa2a5;
  color: #fff !important;
  font: inherit;
  font-size: 1.05em;
  font-weight: 700;
  padding: 14px 20px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
  box-shadow: 0 8px 18px rgba(26, 162, 165, 0.25);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-quick i {
  font-size: 1.25em;
  opacity: 0.95;
  width: 1.15em;
  height: 1.15em;
}

.btn-quick:hover {
  background: #158f92;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(26, 162, 165, 0.32);
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px 12px;
}
.perm-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9em;
}
.perm-grid input { width: auto; transform: scale(1.15); }

@media (max-width: 1100px) {
  .btn-quick {
    font-size: 0.95em;
    padding: 12px 16px;
  }
  #erp-header h1,
  #header-title {
    font-size: 1.15em;
  }
}

@media (max-width: 768px) {
  .dashboard-quick-actions {
    gap: 10px;
  }
  .btn-quick {
    flex: 1 1 calc(50% - 10px);
    justify-content: center;
    font-size: 0.9em;
    padding: 12px 14px;
  }
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 16px;
  width: 100%;
}
.kpi-card {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: right;
  cursor: pointer;
  font: inherit;
  color: inherit;
  margin: 0;
  width: 100%;
  min-height: 132px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(26, 162, 165, 0.35) !important;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}
.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 162, 165, 0.12);
  color: var(--primary-color);
}
.kpi-icon i { width: 1.15em; height: 1.15em; }
.kpi-card.warn .kpi-icon {
  background: rgba(245, 158, 11, 0.16);
  color: #d97706;
}
.kpi-card.is-loss .kpi-value { color: #c62828; }
.kpi-label {
  font-size: 0.82em;
  font-weight: 700;
  color: var(--medium-text);
}
.kpi-value {
  font-size: 1.45em;
  font-weight: 800;
  color: var(--dark-text);
  line-height: 1.2;
  word-break: break-word;
}
.kpi-sub {
  font-size: 0.78em;
  color: var(--medium-text);
  font-weight: 600;
}
@media (max-width: 1100px) {
  .dashboard-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .dashboard-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
