.cfc-container {
  font-family: inherit;
  color: inherit;
  box-sizing: border-box;
  max-width: 100%;
  margin: 0 auto;
  line-height: 1.5;
}
.cfc-container * {
  box-sizing: border-box;
}

.cfc-header-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}
.cfc-unit-toggle {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.cfc-unit-btn {
  background: transparent;
  border: none;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
  font-family: inherit;
}
.cfc-unit-btn.active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.cfc-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cfc-card-header {
  display: flex;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}
.cfc-card-header svg {
  width: 24px;
  height: 24px;
  color: #2563eb;
  margin-right: 12px;
}
.cfc-card-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.cfc-card-body {
  padding: 24px;
}

.cfc-form-group {
  margin-bottom: 20px;
}
.cfc-form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #0f172a;
}
.cfc-required {
  color: #ef4444;
}
.cfc-optional {
  color: #64748b;
  font-weight: 400;
  font-size: 13px;
}

.cfc-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.cfc-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  color: #475569;
  transition: all 0.2s;
  font-family: inherit;
}
.cfc-type-btn svg {
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
}
.cfc-type-btn.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.cfc-divider {
  border: 0;
  height: 1px;
  background: #e2e8f0;
  margin: 24px 0;
}

.cfc-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cfc-input-group {
  position: relative;
  display: flex;
  align-items: center;
}
.cfc-input-group input {
  width: 100%;
  padding: 10px 40px 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 16px;
  color: #0f172a;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}
.cfc-input-group input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}
.cfc-addon {
  position: absolute;
  right: 12px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
}
.cfc-addon-left {
  position: absolute;
  left: 12px;
  color: #94a3b8;
  font-size: 16px;
  pointer-events: none;
}
.cfc-input-group input.has-left {
  padding-left: 30px;
  padding-right: 12px;
}

#val-qty, #val-waste {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#val-qty:focus, #val-waste:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
  outline: none;
}

.cfc-actions {
  display: flex;
  margin-top: 24px;
}
.cfc-btn-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}
.cfc-btn-reset:hover {
  background: #f8fafc;
}
.cfc-btn-reset svg {
  margin-right: 8px;
}

/* Results Section */
.cfc-results-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.cfc-results-header {
  background: #2563eb;
  color: #fff;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.cfc-results-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  opacity: 0.9;
  color: #fff;
}
.cfc-total-main {
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.cfc-total-main span:first-child {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}
.cfc-total-sub {
  margin-top: 6px;
  opacity: 0.9;
  font-size: 0.875rem;
  font-weight: 500;
}

.cfc-btn-print {
  display: flex;
  align-items: center;
  background: #4f8cf6;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.2s;
}
.cfc-btn-print:hover {
  background: #60a5fa;
}
.cfc-btn-print svg {
  margin-right: 8px;
}

.cfc-results-body {
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.cfc-cost-estimate h4 {
  margin: 0 0 16px 0;
  font-size: 1rem;
  color: #0f172a;
  font-weight: 600;
}
.cfc-cost-val {
  font-size: 2rem;
  font-weight: 700;
  color: #0f172a;
}
.cfc-cost-sub {
  color: #64748b;
  font-size: 0.875rem;
  margin-top: 4px;
}
.cfc-cost-empty {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  padding: 16px;
  border-radius: 8px;
  color: #64748b;
  font-size: 0.875rem;
  font-style: italic;
}

.cfc-quick-stats ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cfc-quick-stats li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  color: #475569;
  font-size: 0.875rem;
}
.cfc-quick-stats li strong {
  color: #0f172a;
}
.cfc-stat-total {
  border-top: 1px solid #e2e8f0;
  margin-top: 8px;
  padding-top: 12px !important;
  font-weight: 600;
  color: #0f172a !important;
  font-size: 1rem !important;
}

/* Bags table */
.cfc-card-header-small {
  padding: 20px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.cfc-card-header-small h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #0f172a;
  display: flex;
  align-items: center;
}
.cfc-card-header-small p {
  margin: 4px 0 0 0;
  color: #64748b;
  font-size: 0.875rem;
}
.cfc-card-header-small h3 svg {
  color: #2563eb;
  margin-right: 8px;
}

.cfc-table-wrapper {
  overflow-x: auto;
}
.cfc-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.cfc-table th {
  padding: 12px 24px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.75rem;
  text-transform: uppercase;
  border-bottom: 1px solid #e2e8f0;
}
.cfc-table th.text-right, .cfc-table td.text-right {
  text-align: right;
}
.cfc-table td {
  padding: 16px 24px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  font-size: 0.875rem;
}
.cfc-table tr:hover td {
  background: #f8fafc;
}
.cfc-table td.fw-bold {
  font-weight: 700;
  color: #2563eb;
  font-size: 1rem;
}

/* Chart */
.cfc-chart {
  display: flex;
  align-items: flex-end;
  height: 200px;
  gap: 12px;
  margin-top: 20px;
  padding-bottom: 24px;
  border-bottom: 1px dashed #cbd5e1;
  position: relative;
}
.cfc-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
}
.cfc-bar {
  width: 100%;
  max-width: 48px;
  background: #3b82f6;
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease-out;
  position: relative;
}
.cfc-bar:hover {
  background: #2563eb;
}
.cfc-bar:hover::after {
  content: attr(data-val);
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}
.cfc-bar-label {
  position: absolute;
  bottom: -24px;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
  text-align: center;
}

/* Formulas */
.cfc-formula-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 20px;
  padding: 24px;
  background: #fff;
}
@media (min-width: 768px) {
  .cfc-formula-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.cfc-formula-box {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  border-bottom: 2px solid #cbd5e1;
}
.cfc-formula-box h4 {
  margin: 0 0 8px 0;
  color: #0f172a;
  font-size: 1rem;
  font-weight: 600;
}
.cfc-formula-box p {
  color: #475569;
  font-size: 0.875rem;
  margin: 0 0 12px 0;
  line-height: 1.4;
}
.cfc-formula-box code {
  display: block;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: monospace;
  font-weight: 600;
  font-size: 0.875rem;
  color: #1e293b;
  border: 1px solid #e2e8f0;
}

/* Responsive */
@media (max-width: 768px) {
  .cfc-type-grid {
    grid-template-columns: 1fr;
  }
  .cfc-results-body {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .cfc-results-header {
    flex-direction: column;
    gap: 16px;
  }
  .cfc-btn-print {
    align-self: stretch;
    justify-content: center;
  }
}

/* Print Styles */
@media print {
  .cfc-no-print {
    display: none !important;
  }
  .cfc-results-card {
    border: none;
    box-shadow: none;
    margin: 0;
  }
  .cfc-results-header {
    background: #fff;
    color: #0f172a;
    padding: 0 0 24px 0;
    border-bottom: 2px solid #e2e8f0;
  }
  .cfc-results-header h3 {
    color: #0f172a;
  }
  .cfc-total-main span:first-child, .cfc-total-sub {
    color: #0f172a;
  }
  .cfc-results-body {
    padding: 24px 0;
  }
  .cfc-card {
    border-color: #cbd5e1;
    break-inside: avoid;
  }
  .cfc-table th {
    background: #fff;
    border-bottom: 2px solid #cbd5e1;
  }
  .cfc-table td {
    border-color: #e2e8f0;
  }
}
