/*
 * Module lock + engine billing (S7): the lock page and modal (js/services/ModuleLock.js), the
 * "Planul meu" tab (AppPlan.js), the agency's "Prețurile mele" (AgencyMyPrices.js) and "Extrase"
 * (AgencyStatements.js), the Control Panel "Facturare proprie" tab (BillingEngineTools.js), locked
 * menu entries and items. The phone rules of the shared tables live in css/phone.css; those of
 * "Prețurile mele" stay with it, below.
 *
 * Every var() carries its fallback, as in css/module-prices.css: the :root block of css/style.scss
 * never reaches the browser and an agency's theme.css defines only the brand colours.
 */

/* Menu entry of an inactive module: visible, with a lock. */
.module-locked > a {
  opacity: 0.75;
}
.module-lock-icon {
  margin-left: 6px;
  font-size: 0.85em;
  color: var(--warning-color, #b45309);
}

/* 'warn' (P3): the menu entry 'enforce' would lock, with a warning sign. */
.module-warn-icon {
  margin-left: 6px;
  font-size: 0.85em;
  color: var(--warning-color, #b45309);
}

/* 'warn' (P3): one band at the top of the page, nothing is blocked (js/services/ModuleLock.js).
   Wraps on a phone: never wider than the page. */
.module-warn-band {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  box-sizing: border-box;
  max-width: 100%;
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid var(--warning-color, #b45309);
  border-left-width: 4px;
  border-radius: var(--border-radius, 2px);
  background: var(--bg-white, #fff);
  color: var(--text-color, #333);
  font-size: 13px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}
.module-warn-band > .fa {
  color: var(--warning-color, #b45309);
}
.module-warn-band .module-warn-text {
  flex: 1 1 220px;
  min-width: 0;
}
.module-warn-band .module-warn-link {
  color: var(--main-color, #22aba6);
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
}

/* Library item of an inactive module (page editor). */
.library-box.module-locked {
  border-color: var(--warning-color, #b45309);
}
.app-item-module-locked {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
}
.app-item-module-locked .js-module-activate {
  color: var(--main-color, #22aba6);
  text-decoration: underline;
  cursor: pointer;
}

/* Shared building blocks. */
.mb-note {
  color: var(--text-muted, #6b7280);
  margin: 6px 0 10px;
}
.mb-note-ok {
  color: var(--success-color, #3c763d);
}
.mb-note-error {
  color: var(--error-color, #cd0b0b);
}
.mb-muted {
  color: var(--text-muted, #6b7280);
}
.mb-card {
  background: var(--bg-white, #fff);
  border: 1px solid var(--border-color, #ddd);
  border-radius: var(--border-radius, 2px);
  padding: 16px;
  margin-bottom: 16px;
}
.mb-card h4,
.mb-card h5 {
  margin-top: 16px;
  color: var(--text-color, #333);
}
.mb-card h4:first-child {
  margin-top: 0;
}
.mb-big {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-color, #333);
}
.mb-gap {
  margin-top: 16px;
}
.mb-terms {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.mb-terms .form-group {
  margin: 0;
}
.mb-terms .btn {
  justify-self: start;
}
@media (min-width: 1024px) {
  .mb-terms {
    grid-template-columns: minmax(0, 320px) minmax(0, 320px) auto;
    align-items: start;
  }
  .mb-terms .btn {
    margin-top: 25px;
  }
}
.mb-inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.mb-inline-form > label {
  margin: 0;
}
.mb-inline-form .form-control {
  width: auto;
  min-width: 120px;
  max-width: 260px;
}
.mb-inline-form .form-control.mb-short {
  min-width: 70px;
  max-width: 80px;
}
.mb-check {
  font-weight: normal;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mb-table {
  width: 100%;
  background: var(--bg-white, #fff);
}
.mb-table th {
  color: var(--text-muted, #6b7280);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color, #ddd);
}
.mb-table td {
  vertical-align: middle;
  border-top: 1px solid var(--border-color-light, #eaeaea);
}
.mb-table .mb-actions {
  white-space: nowrap;
  text-align: right;
}
.mb-table .mb-inline-form {
  margin-top: 6px;
}
.mb-table .mb-inline-form .form-control {
  min-width: 80px;
  max-width: 120px;
}
.mb-unused td {
  background: var(--warning-color-light, rgba(240, 173, 78, 0.1));
}
.mb-lines-row > td {
  background: var(--bg-grey-light, #f9f9f9);
}
.mb-lines {
  margin: 0;
}
.mb-offer {
  border-left: 4px solid var(--main-color, #22aba6);
  background: var(--main-color-light, rgba(34, 171, 166, 0.1));
  padding: 10px 14px;
  border-radius: var(--border-radius, 2px);
  color: var(--text-color, #333);
}
.mb-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--border-radius, 2px);
  font-size: 12px;
  background: var(--bg-grey-light, #f9f9f9);
  color: var(--text-color, #333);
}
.mb-status-draft {
  background: var(--warning-color-light, rgba(240, 173, 78, 0.1));
  color: var(--warning-color, #b45309);
}
.mb-status-confirmed,
.mb-status-invoiced {
  background: var(--success-color-light, rgba(92, 184, 92, 0.1));
  color: var(--success-color, #3c763d);
}

/* Lock page (route of an inactive module) and the "module off" modal. */
.mb-lock-page {
  display: flex;
  justify-content: center;
}
.mb-lock {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
  background: var(--bg-white, #fff);
  border: 1px solid var(--border-color, #ddd);
  border-radius: var(--border-radius, 2px);
  padding: 32px 24px;
}
.mb-lock-icon {
  font-size: 40px;
  color: var(--warning-color, #b45309);
  margin-bottom: 12px;
}
.mb-lock-title {
  margin: 0 0 6px;
  color: var(--text-color, #333);
}
.mb-lock-status {
  color: var(--warning-color, #b45309);
  font-weight: 600;
  margin-bottom: 12px;
}
.mb-lock-desc {
  color: var(--text-muted, #6b7280);
  margin-bottom: 16px;
}
.mb-lock-price {
  font-size: 20px;
  font-weight: 600;
  color: var(--main-color, #22aba6);
}
.mb-lock-trial {
  color: var(--success-color, #3c763d);
  margin-top: 4px;
}
.mb-lock-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.mb-lock-modal .mb-lock {
  border: 0;
  padding: 16px 8px;
}

/* "Prețurile mele": the figures, the example, the bulk markup, the table and the save bar. */
.mp-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.mp-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  background: var(--bg-white, #fff);
  border: 1px solid var(--border-color, #ddd);
  border-radius: var(--border-radius, 2px);
}
.mp-kpi-label {
  margin: 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted, #6b7280);
}
.mp-kpi-value {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-color, #333);
}
.mp-level {
  margin: 0 0 8px;
  color: var(--text-color, #333);
}
.mp-level > span {
  color: var(--text-muted, #6b7280);
}
.mp-levels {
  margin: 0 0 12px;
}
.mp-levels-title {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text-color, #333);
}
.mp-levels-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 170px));
  gap: 8px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
}
.mp-levels-step {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  background: var(--bg-white, #fff);
}
.mp-levels-apps {
  font-variant-numeric: tabular-nums;
  color: var(--text-color, #333);
}
.mp-levels-discount {
  font-size: 18px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--text-color, #333);
}
.mp-levels-current {
  border-color: var(--main-color, #22aba6);
  box-shadow: inset 0 0 0 1px var(--main-color, #22aba6);
}
.mp-levels-yours {
  font-weight: 600;
  color: color-mix(in srgb, var(--main-color, #22aba6) 70%, var(--text-color, #333));
}
.mp-field-error {
  display: block;
  color: var(--error-color, #cd0b0b);
  font-size: 12px;
}
.mp-field-error:empty {
  display: none;
}
.mp-input-error,
.mp-input-error:focus {
  border-color: var(--error-color, #cd0b0b);
}
.mp-ladder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg-grey-light, #f9f9f9);
  border-radius: var(--border-radius, 2px);
}
.mp-ladder-title {
  flex-basis: 100%;
  font-size: 13px;
}
.mp-ladder-step small {
  display: block;
  font-size: 11px;
  color: var(--text-muted, #6b7280);
}
.mp-ladder-arrow {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}
.mp-ladder-result b {
  color: var(--main-color, #22aba6);
}
.mp-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  margin-bottom: 14px;
}
.mp-bulk .form-group {
  margin: 0;
}
.mp-bulk .js-mp-bulk-percent {
  width: 90px;
}
.mp-bulk-note,
.mp-bulk-result {
  flex-basis: 100%;
  margin: 0;
  font-size: 13px;
  color: var(--text-muted, #6b7280);
}
.mp-bulk-result {
  color: var(--text-color, #333);
  font-weight: 600;
}
.mp-bulk-result:empty {
  display: none;
}
.mp-search {
  max-width: 360px;
}
.mp-table .mp-unit {
  display: block;
}
.mp-sale-cell .js-mp-sale {
  width: 100px;
}
.mp-sale-cell small {
  display: block;
}
.mp-reset {
  padding: 0;
  color: var(--main-color, #22aba6);
}
.mp-row-changed .js-mp-sale {
  border-color: var(--main-color, #22aba6);
}
.mp-row-error {
  background: var(--error-color-light, rgba(205, 11, 11, 0.1));
}
.mp-row-error .js-mp-sale,
.mp-row-error .js-mp-sale:focus {
  border-color: var(--error-color, #cd0b0b);
}
.mp-margin-track {
  display: block;
  max-width: 90px;
  height: 4px;
  margin-top: 4px;
  overflow: hidden;
  background: var(--border-color-light, #eaeaea);
  border-radius: 2px;
}
.mp-margin-bar {
  display: block;
  height: 100%;
  width: 0;
  background: var(--success-color, #3c763d);
}
.mp-group-head td {
  padding: 0;
  background: var(--bg-grey-light, #f9f9f9);
}
.mp-group-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-color, #333);
  background: none;
  border: 0;
}
.mp-group-caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text-muted, #6b7280);
  transition: transform 0.15s;
}
.mp-group-toggle[aria-expanded="false"] .mp-group-caret {
  transform: rotate(-90deg);
}
.mp-group-count {
  margin-left: auto;
  font-weight: 400;
  color: var(--text-muted, #6b7280);
}
.mp-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-white, #fff);
  border: 1px solid var(--main-color, #22aba6);
  border-radius: var(--border-radius, 2px);
}
.mp-bar-idle {
  border-color: var(--border-color, #ddd);
}
.mp-bar-text {
  flex: 1 1 240px;
  min-width: 0;
}
.mp-bar-actions {
  display: flex;
  gap: 8px;
}
.mb-engine-tabs {
  margin-bottom: 14px;
}
#billing-sub-tabs,
#discounts-sub-tabs {
  margin-bottom: 16px;
}

/* Phone: the shared stacking of .mb-table (css/phone.css) gives the labelled rows; this keeps the
   group titles and the inputs usable at 375 px. */
@media (max-width: 767px) {
  .mp-kpis {
    grid-template-columns: 1fr;
  }
  .mp-table .mp-group-head {
    margin-bottom: 8px;
    padding: 0;
    border-color: var(--border-color-light, #eaeaea);
  }
  .mp-table .mp-group-head td {
    padding: 0;
  }
  .mp-sale-cell .js-mp-sale {
    width: 100%;
    max-width: none;
  }
  .mp-margin-track {
    max-width: none;
  }
  .mp-bar-actions,
  .mp-bar-actions .btn {
    flex: 1 1 auto;
  }
  .mp-bulk .form-group {
    flex: 1 1 120px;
  }
  .mp-bulk .js-mp-bulk-percent {
    width: 100%;
  }
  .mp-search {
    max-width: none;
  }
}

/* Wide screens: tables keep their columns, forms stay on one line. */
@media (min-width: 1024px) {
  .mb-plan,
  .mb-agency-billing,
  .mb-engine-tools {
    max-width: 1100px;
  }
  .mb-table .mb-inline-form {
    flex-wrap: nowrap;
  }
}
