/* Hisabaat Business V0.11.2 — isolated POS calculator feature. */
.nav-btn-with-icon {
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav-feature-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.pos-calculator-page {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  overflow-x: clip;
}

.pos-calculator-root {
  --pos-bg: #f5f7f8;
  --pos-card: #ffffff;
  --pos-card-soft: #f8fafc;
  --pos-main: #123048;
  --pos-text: #0f172a;
  --pos-text-strong: #123048;
  --pos-muted: #64748b;
  --pos-faint: #94a3b8;
  --pos-line: #e2e8f0;
  --pos-line-soft: #f1f5f9;
  --pos-teal: #0d9488;
  --pos-teal-dark: #0f766e;
  --pos-teal-soft: #f0fdfa;
  --pos-teal-line: #ccfbf1;
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: calc(100vh - 92px);
  overflow-x: clip;
  background: var(--pos-bg);
  color: var(--pos-text);
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  transition: background-color .26s ease, color .26s ease;
}

.pos-calculator-root *,
.pos-calculator-root *::before,
.pos-calculator-root *::after {
  box-sizing: border-box;
}

.pos-calculator-root button,
.pos-calculator-root input,
.pos-calculator-root select {
  font: inherit;
}

.pos-calculator-root button:not(:disabled),
.pos-calculator-root select:not(:disabled) {
  cursor: pointer;
}

.pos-icon {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  flex: 0 0 auto;
  vertical-align: -0.15em;
}

.pos-decor {
  position: absolute;
  inset: 0 0 auto;
  pointer-events: none;
}

.pos-decor-main {
  height: 560px;
  background:
    radial-gradient(circle at 12% 8%, rgba(44, 183, 169, .17), transparent 30%),
    radial-gradient(circle at 90% 0%, rgba(18, 48, 72, .15), transparent 38%);
}

.pos-decor-dashboard {
  height: 430px;
  background:
    radial-gradient(circle at 15% 0%, rgba(44, 183, 169, .16), transparent 34%),
    radial-gradient(circle at 90% 0%, rgba(18, 48, 72, .14), transparent 38%);
}

.pos-content {
  position: relative;
  width: 100%;
  max-width: 1152px;
  min-width: 0;
  margin: 0 auto;
  padding: 8px 0 48px;
}

.pos-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.pos-hero-copy {
  max-width: 680px;
}

.pos-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px 12px;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: var(--pos-teal-dark);
  box-shadow: 0 2px 5px rgba(20, 47, 66, .05);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 800;
}

.pos-hero h2 {
  margin: 0;
  color: var(--pos-text-strong);
  font-family: "Space Grotesk", "IBM Plex Sans Arabic", "Segoe UI", sans-serif;
  font-size: clamp(36px, 4vw, 48px);
  font-weight: 850;
  letter-spacing: -.025em;
  line-height: 1.15;
}

.pos-hero-copy > p {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--pos-muted);
  font-size: 17px;
  line-height: 1.9;
}

.pos-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 2px 8px rgba(20, 47, 66, .06);
  backdrop-filter: blur(8px);
}

.pos-hero-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: var(--pos-main);
  color: #99f6e4;
  font-size: 20px;
}

.pos-date-summary {
  display: grid;
  min-width: 116px;
  gap: 2px;
}

.pos-date-summary small {
  color: var(--pos-faint);
  font-size: 11px;
}

.pos-date-summary strong {
  color: var(--pos-text);
  font-size: 13px;
}

.pos-header-button,
.pos-icon-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--pos-line);
  border-radius: 12px;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.pos-header-button {
  padding: 8px 12px;
}

.pos-header-button .pos-icon {
  color: var(--pos-teal);
}

.pos-icon-button {
  width: 40px;
  padding: 0;
}

.pos-header-button:hover,
.pos-icon-button:hover {
  border-color: #99f6e4;
  background: var(--pos-card-soft);
}

.pos-header-button:active,
.pos-icon-button:active,
.pos-button:active,
.pos-rate-button:active,
.pos-comparison-option:active,
.pos-history-card:active {
  transform: scale(.98);
}

.pos-main-grid {
  display: grid;
  grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr);
  align-items: start;
  gap: 24px;
}

.pos-input-card {
  order: 1;
}

.pos-results-column {
  display: grid;
  order: 2;
  min-width: 0;
  gap: 24px;
}

.pos-card,
.pos-metric-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid rgba(226, 232, 240, .82);
  border-radius: 28px;
  background: var(--pos-card);
  box-shadow: 0 18px 60px rgba(20, 47, 66, .07);
}

.pos-input-card {
  padding: 28px;
}

.pos-section-heading,
.pos-details-heading,
.pos-comparison-heading,
.pos-history-heading,
.pos-dashboard-card-heading,
.pos-recent-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.pos-section-heading {
  margin-bottom: 28px;
}

.pos-section-heading small,
.pos-comparison-heading small,
.pos-history-heading > div > small,
.pos-dashboard-card-heading small,
.pos-recent-heading small,
.pos-average-card > small {
  display: block;
  margin-bottom: 4px;
  color: var(--pos-teal);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.pos-section-heading h3,
.pos-details-heading h3,
.pos-comparison-heading h3,
.pos-history-heading h3,
.pos-dashboard-card-heading h3,
.pos-recent-heading h3,
.pos-average-card h3 {
  margin: 0;
  color: var(--pos-text-strong);
  font-size: 23px;
  font-weight: 850;
}

.pos-section-heading > span,
.pos-details-heading > span {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 16px;
  background: var(--pos-teal-soft);
  color: var(--pos-teal-dark);
  font-size: 20px;
}

.pos-fields {
  display: grid;
  gap: 20px;
}

.pos-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.pos-field-label label,
.pos-representative-heading label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1e293b;
  font-size: 14px;
  font-weight: 800;
}

.pos-field-label > span,
.pos-representative-heading small {
  color: var(--pos-faint);
  font-size: 11px;
  font-weight: 650;
}

.pos-field-icon,
.pos-representative-heading label > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  font-size: 15px;
}

.pos-calculator-root input,
.pos-calculator-root select {
  width: 100%;
  min-width: 0;
  height: 48px;
  border: 1px solid var(--pos-line);
  border-radius: 16px;
  outline: 0;
  background: rgba(248, 250, 252, .7);
  color: var(--pos-text);
  box-shadow: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.pos-calculator-root input {
  padding: 10px 42px 10px 14px;
}

.pos-calculator-root select {
  padding: 8px 12px;
}

.pos-calculator-root input:focus,
.pos-calculator-root select:focus {
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, .15);
}

.pos-input-wrap {
  position: relative;
  min-width: 0;
}

.pos-input-wrap > input {
  padding-left: 56px;
  padding-right: 14px;
  text-align: left;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.pos-input-wrap > span {
  position: absolute;
  top: 50%;
  left: 14px;
  color: var(--pos-faint);
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 13px;
  font-weight: 800;
}

.pos-field:first-child .pos-input-wrap > input {
  height: 56px;
  font-size: 18px;
}

.pos-representative-box {
  padding: 16px;
  border: 1px solid var(--pos-teal-line);
  border-radius: 16px;
  background: rgba(240, 253, 250, .56);
}

.pos-representative-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.pos-representative-heading label > span {
  background: var(--pos-card);
  color: var(--pos-teal-dark);
  box-shadow: 0 2px 5px rgba(20, 47, 66, .06);
}

.pos-representative-heading small {
  color: var(--pos-teal-dark);
}

.pos-representative-box select,
.pos-representative-box input {
  height: 44px;
  border-color: var(--pos-teal-line);
  border-radius: 12px;
  background: var(--pos-card);
}

.pos-representative-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px auto;
  gap: 8px;
  margin-top: 12px;
}

.pos-system-representative-rate {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--pos-teal-line);
  border-radius: 12px;
  background: var(--pos-card);
}

.pos-system-representative-rate-head {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.pos-system-representative-rate-head > span:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.pos-system-representative-rate-head strong {
  overflow-wrap: anywhere;
  color: var(--pos-text);
  font-size: 13px;
}

.pos-system-representative-rate-head small,
.pos-system-representative-rate > p {
  color: var(--pos-faint);
  font-size: 11px;
  line-height: 1.65;
}

.pos-system-representative-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--pos-teal-soft);
  color: var(--pos-teal-dark);
  font-size: 10px;
  font-weight: 800;
}

.pos-system-representative-rate-controls {
  display: grid;
  grid-template-columns: minmax(0, 110px) minmax(132px, auto);
  justify-content: start;
  gap: 8px;
}

.pos-system-representative-rate-controls .pos-button {
  white-space: nowrap;
}

.pos-system-representative-rate > p {
  margin: 0;
}

.pos-representative-form .pos-input-wrap input {
  padding-left: 30px;
}

.pos-representative-form .pos-input-wrap span {
  left: 10px;
}

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

.pos-representative-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  gap: 2px;
  padding: 4px 6px 4px 8px;
  border-radius: 9px;
  background: var(--pos-card);
  color: #475569;
  box-shadow: 0 2px 5px rgba(20, 47, 66, .07);
  font-size: 12px;
  font-weight: 750;
}

.pos-representative-chip button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--pos-faint);
  font-size: 14px;
}

.pos-representative-chip button:hover {
  background: #f1f5f9;
  color: var(--pos-teal);
}

.pos-representative-chip button[data-pos-action="delete-representative"]:hover {
  background: #fef2f2;
  color: #dc2626;
}

.pos-rate-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.pos-rate-button {
  display: inline-flex;
  min-width: 0;
  min-height: 42px;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--pos-line);
  border-radius: 12px;
  background: var(--pos-card);
  color: #475569;
  font-size: 14px;
  font-weight: 800;
  transition: all .2s ease;
}

.pos-rate-button:hover {
  border-color: #5eead4;
  background: var(--pos-teal-soft);
}

.pos-rate-button.is-active {
  border-color: var(--pos-main);
  background: var(--pos-main);
  color: #fff;
  box-shadow: 0 8px 18px rgba(18, 48, 72, .16);
}

.pos-rate-button.is-custom {
  border-color: var(--pos-teal);
  background: var(--pos-teal);
  color: #fff;
  box-shadow: 0 8px 18px rgba(13, 148, 136, .17);
}

.pos-input-wrap input.is-custom-input {
  border-color: #5eead4;
}

.pos-field-help,
.pos-open-note {
  margin: 8px 0 0;
  color: var(--pos-faint);
  font-size: 12px;
  line-height: 1.7;
}

.pos-double-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.pos-date-input {
  padding: 10px 14px !important;
  text-align: left;
}

.pos-operation-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--pos-line-soft);
}

.pos-button {
  display: inline-flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 850;
  transition: background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
}

.pos-button-teal {
  background: var(--pos-teal);
  color: #fff;
  box-shadow: 0 8px 18px rgba(13, 148, 136, .15);
}

.pos-button-teal:hover {
  background: var(--pos-teal-dark);
}

.pos-button-dark {
  background: var(--pos-main);
  color: #fff;
  box-shadow: 0 8px 18px rgba(18, 48, 72, .15);
}

.pos-button-dark:hover {
  background: #1c4865;
}

.pos-button-outline {
  border-color: var(--pos-line);
  background: transparent;
  color: #475569;
}

.pos-button-outline:hover {
  background: var(--pos-card-soft);
}

.pos-final-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 32px;
  border-radius: 28px;
  background: var(--pos-main);
  color: #fff;
  box-shadow: 0 22px 70px rgba(18, 48, 72, .24);
}

.pos-final-ring {
  position: absolute;
  border: 1px solid rgba(94, 234, 212, .2);
  border-radius: 50%;
}

.pos-final-ring-one {
  top: -40px;
  left: -32px;
  width: 176px;
  height: 176px;
}

.pos-final-ring-two {
  top: 28px;
  left: -4px;
  width: 96px;
  height: 96px;
  opacity: .75;
}

.pos-final-content {
  position: relative;
}

.pos-final-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
}

.pos-final-head > div > small {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #99f6e4;
  font-size: 13px;
  font-weight: 750;
}

.pos-final-head h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 850;
}

.pos-rate-badge {
  display: grid;
  min-width: 70px;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .1);
  text-align: center;
  backdrop-filter: blur(6px);
}

.pos-rate-badge small {
  color: rgba(204, 251, 241, .72);
  font-size: 10px;
}

.pos-rate-badge strong {
  color: #99f6e4;
  font-size: 14px;
}

.pos-final-value {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #fff;
  font-family: "Space Grotesk", "IBM Plex Sans Arabic", "Segoe UI", sans-serif;
  font-size: clamp(34px, 5vw, 50px);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  letter-spacing: -.025em;
  line-height: 1.2;
  text-align: left;
}

.pos-final-divider {
  height: 1px;
  margin: 28px 0 20px;
  background: rgba(255, 255, 255, .1);
}

.pos-final-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pos-final-totals span {
  display: grid;
  gap: 6px;
}

.pos-final-totals small {
  color: #cbd5e1;
  font-size: 13px;
}

.pos-final-totals strong {
  color: #fff;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.pos-final-totals span:last-child strong {
  color: #99f6e4;
}

.pos-details-card {
  padding: 12px 28px;
}

.pos-details-heading {
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--pos-line-soft);
}

.pos-details-heading h3,
.pos-comparison-heading h3 {
  font-size: 16px;
}

.pos-details-heading p {
  margin: 4px 0 0;
  color: var(--pos-faint);
  font-size: 12px;
}

.pos-details-heading > span {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #f1f5f9;
  color: var(--pos-muted);
  font-size: 16px;
}

.pos-result-line,
.pos-deliverable-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.pos-result-line span {
  color: #334155;
  font-size: 14px;
  font-weight: 650;
}

.pos-result-line strong {
  color: var(--pos-text);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.pos-result-line.is-muted span,
.pos-result-line.is-muted strong {
  color: var(--pos-muted);
  font-weight: 500;
}

.pos-dashed-divider {
  border-top: 1px dashed var(--pos-line);
}

.pos-deliverable-line > strong:first-child {
  color: var(--pos-text-strong);
  font-size: 15px;
  font-weight: 850;
}

.pos-deliverable-line > strong:last-child {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.pos-teal {
  color: var(--pos-teal-dark) !important;
}

.pos-comparison-card {
  padding: 28px;
}

.pos-comparison-heading {
  align-items: flex-end;
  margin-bottom: 20px;
}

.pos-comparison-heading > span {
  color: var(--pos-faint);
  font-size: 12px;
}

.pos-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pos-comparison-option {
  display: grid;
  grid-template-columns: 1fr auto;
  min-width: 0;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--pos-line-soft);
  border-radius: 16px;
  background: rgba(248, 250, 252, .7);
  color: var(--pos-text);
  text-align: right;
  transition: all .2s ease;
}

.pos-comparison-option:hover {
  border-color: #99f6e4;
  box-shadow: 0 8px 18px rgba(20, 47, 66, .08);
  transform: translateY(-2px);
}

.pos-comparison-option.is-active {
  border-color: #5eead4;
  background: rgba(240, 253, 250, .75);
}

.pos-comparison-option > span {
  width: max-content;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--pos-card);
  color: #475569;
  box-shadow: 0 2px 5px rgba(20, 47, 66, .06);
  font-size: 12px;
  font-weight: 850;
}

.pos-comparison-option > .pos-icon {
  color: var(--pos-teal);
}

.pos-comparison-option small,
.pos-comparison-option strong {
  grid-column: 1 / -1;
}

.pos-comparison-option small {
  margin-top: 2px;
  color: var(--pos-muted);
  font-size: 12px;
}

.pos-comparison-option strong {
  overflow-wrap: anywhere;
  color: var(--pos-text-strong);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.pos-open-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
}

.pos-open-note .pos-icon {
  margin-top: 3px;
  color: var(--pos-teal);
}

.pos-history-section {
  margin-top: 32px;
  padding: 28px;
}

.pos-history-heading {
  align-items: flex-end;
  margin-bottom: 20px;
}

.pos-history-heading p {
  margin: 4px 0 0;
  color: var(--pos-faint);
  font-size: 14px;
}

.pos-clear-history {
  min-height: 40px;
  font-size: 12px;
}

.pos-clear-history:hover {
  border-color: #fecaca;
  background: #fef2f2;
  color: #dc2626;
}

.pos-empty-state {
  padding: 32px 20px;
  border: 1px dashed var(--pos-line);
  border-radius: 16px;
  background: rgba(248, 250, 252, .66);
  color: var(--pos-faint);
  text-align: center;
  font-size: 14px;
}

.pos-tall-empty {
  padding-block: 48px;
}

.pos-history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.pos-history-card {
  display: block;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--pos-line-soft);
  border-radius: 16px;
  background: rgba(248, 250, 252, .7);
  color: var(--pos-text);
  text-align: right;
  transition: all .2s ease;
}

.pos-history-card:hover {
  border-color: #99f6e4;
  background: rgba(240, 253, 250, .6);
  box-shadow: 0 8px 18px rgba(20, 47, 66, .08);
  transform: translateY(-2px);
}

.pos-history-card-head,
.pos-history-card-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pos-history-card-head > span {
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--pos-card);
  color: var(--pos-muted);
  box-shadow: 0 2px 5px rgba(20, 47, 66, .06);
  font-size: 11px;
  font-weight: 750;
}

.pos-history-card-head .pos-icon {
  color: #cbd5e1;
}

.pos-history-card-body {
  align-items: flex-end;
  margin-top: 16px;
}

.pos-history-card-body > span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.pos-history-card-body > span:last-child {
  text-align: left;
}

.pos-history-card-body small {
  color: var(--pos-muted);
  font-size: 11px;
}

.pos-history-card-body strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #1e293b;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pos-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid rgba(226, 232, 240, .82);
  color: var(--pos-faint);
  font-size: 12px;
}

/* Calculator dashboard */
.pos-dashboard-hero {
  margin-bottom: 30px;
}

.pos-dashboard-actions {
  align-self: flex-end;
}

.pos-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.pos-metric-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  transition: transform .2s ease;
}

.pos-metric-card:hover {
  transform: translateY(-2px);
}

.pos-metric-card > div {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.pos-metric-card > div small {
  color: var(--pos-faint);
  font-size: 11px;
  font-weight: 700;
}

.pos-metric-card > div strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--pos-text-strong);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.pos-metric-card > span {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  font-size: 19px;
}

.pos-metric-card > span.is-dark { background: var(--pos-main); color: #99f6e4; }
.pos-metric-card > span.is-teal { background: var(--pos-teal); color: #fff; }
.pos-metric-card > span.is-light-teal { background: var(--pos-card); color: var(--pos-teal-dark); }
.pos-metric-card > span.is-light-dark { background: var(--pos-card); color: var(--pos-main); }

.pos-dashboard-grid {
  display: grid;
  align-items: stretch;
  gap: 24px;
  margin-top: 24px;
}

.pos-dashboard-grid-primary {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
}

.pos-dashboard-grid-secondary {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
}

.pos-dashboard-card {
  padding: 28px;
}

.pos-dashboard-card-heading {
  align-items: flex-end;
  margin-bottom: 24px;
}

.pos-dashboard-card-heading > .pos-icon {
  color: var(--pos-teal);
  font-size: 20px;
}

.pos-stat-list,
.pos-comparison-stats {
  display: grid;
  gap: 20px;
}

.pos-stat-row-head,
.pos-stat-row-foot,
.pos-comparison-stat-head,
.pos-bar-line,
.pos-contribution-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pos-stat-row-head {
  margin-bottom: 8px;
  font-size: 13px;
}

.pos-stat-row-head > span {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.pos-stat-row-head > span strong {
  color: #334155;
}

.pos-stat-row-head small {
  color: var(--pos-faint);
  font-size: 11px;
}

.pos-stat-row-head > strong {
  color: var(--pos-text-strong);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.pos-progress {
  display: block;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #f1f5f9;
}

.pos-stat-row > .pos-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(to left, #14b8a6, var(--pos-main));
}

.pos-stat-row-foot {
  margin-top: 6px;
  color: var(--pos-faint);
  font-size: 11px;
}

.pos-average-card {
  padding: 28px;
  border-radius: 28px;
  background: var(--pos-main);
  color: #fff;
  box-shadow: 0 22px 70px rgba(18, 48, 72, .18);
}

.pos-average-card > small {
  color: #99f6e4;
}

.pos-average-card h3 {
  color: #fff;
}

.pos-average-card > strong {
  display: block;
  margin-top: 30px;
  overflow-wrap: anywhere;
  font-family: "Space Grotesk", "IBM Plex Sans Arabic", "Segoe UI", sans-serif;
  font-size: clamp(32px, 4vw, 42px);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.pos-average-card > p {
  margin: 8px 0 0;
  color: #cbd5e1;
  font-size: 13px;
}

.pos-average-card > div {
  height: 1px;
  margin: 30px 0 18px;
  background: rgba(255, 255, 255, .1);
}

.pos-average-card > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.pos-average-card > span small {
  color: #cbd5e1;
}

.pos-average-card > span b {
  color: #99f6e4;
}

.pos-comparison-stat {
  display: grid;
  gap: 9px;
}

.pos-comparison-stat-head > span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pos-comparison-stat-head > span b {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--pos-teal-soft);
  color: var(--pos-teal-dark);
  font-size: 11px;
}

.pos-comparison-stat-head > span strong {
  color: #334155;
  font-size: 13px;
}

.pos-comparison-stat-head > small {
  color: var(--pos-muted);
  font-size: 11px;
  font-weight: 750;
}

.pos-comparison-stat-head > small b {
  color: var(--pos-teal-dark);
}

.pos-bar-line > small {
  width: 48px;
  flex: 0 0 48px;
  color: var(--pos-faint);
  font-size: 10px;
  font-weight: 800;
}

.pos-bar-line > .pos-progress {
  flex: 1 1 auto;
  min-width: 30px;
}

.pos-bar-line > .pos-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.pos-bar-line > .pos-progress i.is-sales { background: var(--pos-main); }
.pos-bar-line > .pos-progress i.is-commission { background: #14b8a6; }

.pos-bar-line > strong {
  width: 112px;
  flex: 0 0 112px;
  color: #334155;
  text-align: left;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.pos-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--pos-line-soft);
  color: var(--pos-faint);
  font-size: 11px;
}

.pos-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.pos-chart-legend i,
.pos-contribution-row i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.pos-chart-legend i.is-sales { background: var(--pos-main); }
.pos-chart-legend i.is-commission,
.pos-contribution-row i { background: #14b8a6; }

.pos-contribution-layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.pos-donut {
  display: grid;
  width: 176px;
  height: 176px;
  flex: 0 0 176px;
  place-items: center;
  border-radius: 50%;
}

.pos-donut > span {
  display: grid;
  width: 112px;
  height: 112px;
  place-content: center;
  gap: 4px;
  border-radius: 50%;
  background: var(--pos-card);
  text-align: center;
}

.pos-donut strong {
  color: var(--pos-text-strong);
  font-size: 24px;
  font-weight: 850;
}

.pos-donut small {
  color: var(--pos-faint);
  font-size: 10px;
}

.pos-contribution-list {
  display: grid;
  width: 100%;
  gap: 12px;
}

.pos-contribution-row {
  color: #475569;
  font-size: 13px;
}

.pos-contribution-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.pos-contribution-row strong {
  color: var(--pos-text-strong);
  font-weight: 850;
}

.pos-muted-copy,
.pos-dashboard-empty {
  color: var(--pos-faint);
  font-size: 13px;
}

.pos-top-representative {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--pos-line-soft);
  color: var(--pos-faint);
  font-size: 11px;
}

.pos-recent-section {
  margin-top: 24px;
}

.pos-recent-heading {
  align-items: flex-end;
  margin-bottom: 20px;
}

.pos-recent-heading > span {
  color: var(--pos-faint);
  font-size: 11px;
}

.pos-dashboard-empty {
  margin: 0;
  padding: 32px 0;
  text-align: center;
}

.pos-dashboard-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.pos-dashboard-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  color: var(--pos-text);
  text-align: right;
  font-size: 12px;
}

.pos-dashboard-table th,
.pos-dashboard-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--pos-line-soft);
  white-space: nowrap;
}

.pos-dashboard-table th {
  position: static;
  background: transparent;
  color: var(--pos-faint);
  font-size: 11px;
  font-weight: 600;
}

.pos-dashboard-table td {
  color: var(--pos-muted);
}

.pos-dashboard-table td:nth-child(2),
.pos-dashboard-table td:nth-child(3) {
  color: #334155;
  font-weight: 750;
}

/* The app shell keeps a 265px desktop sidebar, so collapse slightly earlier than
   the standalone source to preserve the source card proportions at 1024px. */
@media (max-width: 1099px) {
  .pos-main-grid {
    grid-template-columns: 1fr;
  }

  .pos-input-card { order: 2; }
  .pos-results-column { order: 1; }

  .pos-metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .pos-dashboard-grid-primary,
  .pos-dashboard-grid-secondary {
    grid-template-columns: 1fr;
  }

  .pos-history-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .pos-calculator-page {
    width: 100%;
    margin: 0;
  }

  .pos-calculator-root {
    min-height: calc(100vh - 80px);
  }

  .pos-content {
    padding: 8px 0 36px;
  }

  .pos-hero {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 24px;
  }

  .pos-hero h2 {
    font-size: 34px;
  }

  .pos-hero-copy > p {
    font-size: 15px;
    line-height: 1.8;
  }

  .pos-hero-actions {
    width: 100%;
    align-self: stretch;
    flex-wrap: wrap;
  }

  .pos-date-summary {
    min-width: 0;
    flex: 1 1 auto;
  }

  .pos-date-summary strong {
    overflow-wrap: anywhere;
  }

  .pos-header-button {
    min-width: 44px;
    padding-inline: 10px;
  }

  .pos-header-button span {
    display: none;
  }

  .pos-main-grid,
  .pos-results-column {
    width: 100%;
    min-width: 0;
    gap: 18px;
  }

  .pos-card,
  .pos-final-card,
  .pos-average-card {
    border-radius: 22px;
  }

  .pos-input-card,
  .pos-comparison-card,
  .pos-history-section,
  .pos-dashboard-card,
  .pos-average-card {
    padding: 20px;
  }

  .pos-representative-box {
    min-width: 0;
    padding: 14px;
  }

  .pos-representative-heading {
    flex-wrap: wrap;
  }

  .pos-final-card {
    padding: 24px 20px;
  }

  .pos-details-card {
    padding-inline: 20px;
  }

  .pos-final-value {
    font-size: clamp(29px, 9.4vw, 40px);
  }

  .pos-final-totals strong,
  .pos-result-line strong,
  .pos-deliverable-line > strong:last-child {
    overflow-wrap: anywhere;
  }

  .pos-history-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .pos-clear-history {
    align-self: flex-start;
  }

  .pos-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .pos-contribution-layout {
    align-items: center;
    flex-direction: column;
  }

  .pos-dashboard-actions {
    align-self: stretch;
  }

  .pos-representative-chip button {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 520px) {
  .pos-representative-form {
    grid-template-columns: minmax(0, 1fr) 92px;
  }

  .pos-representative-form > .pos-button {
    grid-column: 1 / -1;
  }

  .pos-operation-buttons,
  .pos-double-field,
  .pos-comparison-grid,
  .pos-history-grid,
  .pos-metrics-grid {
    grid-template-columns: 1fr;
  }

  .pos-system-representative-rate-controls {
    grid-template-columns: 1fr;
  }

  .pos-system-representative-rate-controls .pos-button {
    width: 100%;
  }

  .pos-rate-buttons {
    gap: 6px;
  }

  .pos-rate-button {
    padding-inline: 6px;
    font-size: 12px;
  }

  .pos-final-head {
    margin-bottom: 24px;
  }

  .pos-final-totals {
    grid-template-columns: 1fr;
  }

  .pos-history-card-body {
    align-items: flex-start;
    flex-direction: column;
  }

  .pos-history-card-body > span:last-child {
    text-align: right;
  }

  .pos-comparison-stat-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .pos-bar-line {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 8px;
  }

  .pos-bar-line > small {
    width: auto;
    flex: initial;
  }

  .pos-bar-line > strong {
    grid-column: 2;
    width: auto;
    flex: initial;
    text-align: right;
  }
}

@media (max-width: 350px) {
  .pos-content {
    padding-inline: 0;
  }

  .pos-hero-actions {
    gap: 7px;
    padding: 9px;
  }

  .pos-hero-icon {
    width: 36px;
    height: 36px;
  }

  .pos-date-summary strong {
    font-size: 11px;
  }

  .pos-header-button {
    width: 40px;
    min-width: 40px;
  }

  .pos-input-card,
  .pos-comparison-card,
  .pos-history-section,
  .pos-dashboard-card,
  .pos-average-card {
    padding-inline: 16px;
  }

  .pos-result-line,
  .pos-deliverable-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  body.pos-printing {
    background: #fff !important;
  }

  body.pos-printing #authShell,
  body.pos-printing #platformShell,
  body.pos-printing .sidebar,
  body.pos-printing .sidebar-backdrop,
  body.pos-printing .topbar,
  body.pos-printing #globalError,
  body.pos-printing #loadingBar,
  body.pos-printing #toast,
  body.pos-printing .page:not(#page-pos-calculator) {
    display: none !important;
  }

  body.pos-printing .app-shell,
  body.pos-printing .main,
  body.pos-printing #page-pos-calculator,
  body.pos-printing #posCalculatorMount,
  body.pos-printing .pos-calculator-root {
    display: block !important;
    width: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    color: #0f172a !important;
  }

  body.pos-printing .pos-content {
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
  }

  body.pos-printing .pos-decor {
    display: none !important;
  }

  body.pos-printing .pos-calculator-root {
    --pos-bg: #fff;
    --pos-card: #fff;
    --pos-card-soft: #f8fafc;
    --pos-text: #0f172a;
    --pos-text-strong: #123048;
    --pos-muted: #64748b;
    --pos-faint: #94a3b8;
    --pos-line: #e2e8f0;
    --pos-line-soft: #f1f5f9;
  }

  body.pos-printing .pos-hero-actions,
  body.pos-printing .pos-operation-buttons,
  body.pos-printing .pos-clear-history,
  body.pos-printing .pos-representative-form,
  body.pos-printing .pos-representative-chips {
    display: none !important;
  }

  body.pos-printing .pos-hero {
    margin-bottom: 6mm;
  }

  body.pos-printing .pos-hero h2 {
    color: #123048 !important;
    font-size: 28px;
  }

  body.pos-printing .pos-hero-copy > p {
    color: #64748b !important;
    font-size: 12px;
  }

  body.pos-printing .pos-main-grid {
    grid-template-columns: .88fr 1.12fr !important;
    gap: 5mm;
  }

  body.pos-printing .pos-input-card { order: 1 !important; }
  body.pos-printing .pos-results-column { order: 2 !important; gap: 4mm; }

  body.pos-printing .pos-card,
  body.pos-printing .pos-final-card {
    break-inside: avoid;
    box-shadow: none !important;
  }

  body.pos-printing .pos-card {
    border-color: #dbe3ea !important;
    background: #fff !important;
  }

  body.pos-printing .pos-final-card {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
    background: #123048 !important;
  }

  body.pos-printing .pos-history-section {
    margin-top: 6mm;
  }

  body.pos-printing .pos-history-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  body.pos-printing .pos-footer {
    margin-top: 6mm;
  }
}
