:root {
  --pico-font-size: 16px;
}

.category-supplies {
  background-color: #e3f2fd;
}

.category-benefits {
  background-color: #f3e5f5;
}

.split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 768px) {
  .split-view {
    grid-template-columns: 1fr;
  }
}

.summary-card {
  text-align: center;
  padding: 1rem;
  border-radius: 8px;
}

.drag-area {
  border: 2px dashed var(--pico-muted-border-color);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
}

.drag-area.dragover {
  border-color: var(--pico-primary);
  background: var(--pico-primary-focus);
}

.filters {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.totals {
  font-weight: bold;
  background: var(--pico-card-background-color);
}

.expense-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.expense-card {
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--pico-muted-border-color);
}

.expense-card header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.expense-card .badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.875rem;
  background: var(--pico-primary-focus);
}

.expense-card footer {
  margin-top: 0.5rem;
  text-align: right;
}

.import-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.import-card {
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid var(--pico-muted-border-color);
}

.import-card.success {
  border-left-color: #4caf50;
}

.import-card.partial {
  border-left-color: #ff9800;
}

.import-card header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.import-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--pico-muted-color);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--pico-muted-color);
}

/* Slider with arrow buttons container */
.slider-with-arrows {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.slider-arrow {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  border: none;
  border-radius: 4px;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.4rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}

.slider-arrow:hover {
  background: var(--pico-primary-hover);
  transform: scale(1.1);
}

.slider-arrow:active {
  transform: scale(0.95);
}

.slider-arrow:focus {
  outline: 2px solid var(--pico-primary);
  outline-offset: 2px;
}

/* noUiSlider custom styling */
.allocation-slider {
  height: 20px;
  margin: 0;
  max-width: 100%;
  flex: 1;
  padding: 0 10px;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .allocation-slider {
    height: 18px;
    margin: 0.25rem 0;
  }
}

.allocation-slider .noUi-connect {
  background: linear-gradient(90deg, #4caf50 0%, #2196f3 100%);
}

.allocation-slider .noUi-handle {
  border: 2px solid #333;
  border-radius: 50%;
  background: white;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  width: 18px;
  height: 18px;
}

@media (max-width: 768px) {
  .allocation-slider .noUi-handle {
    width: 16px;
    height: 16px;
  }
}

.allocation-slider .noUi-handle:hover {
  border-color: #2196f3;
}

.allocation-slider .noUi-tooltip {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: none;
  border-radius: 3px;
  padding: 0.188rem 0.375rem;
  font-size: 0.688rem;
  line-height: 1;
}

/* Dual-column allocation board (ADR-016)
 * Grid layout for Business Supplies | Board Member Benefits
 * Sticky headers, independent scrolling, responsive design
 */
.allocation-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1rem;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  height: calc(100vh - 200px);
  align-items: start;
}

/* Smaller desktop - reduce gap */
@media (max-width: 1024px) {
  .allocation-board {
    gap: 0.75rem;
  }
}

/* Tablet landscape - reduce gap further but keep 2 columns */
@media (max-width: 768px) {
  .allocation-board {
    gap: 0.5rem;
  }
}

/* Mobile only - switch to single column */
@media (max-width: 640px) {
  .allocation-board {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
  }
}

.allocation-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  height: 100%;
  max-height: calc(100vh - 200px);
}

.column-header {
  background: var(--pico-card-background-color);
  border: 2px solid var(--pico-primary);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  margin-bottom: 0;
  padding-bottom: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .column-header {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
  }
}

@media (max-width: 640px) {
  .column-header {
    padding: 0.625rem;
    margin-bottom: 0.5rem;
  }
}

.allocation-column.business-supplies .column-header {
  border-color: #4caf50;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, var(--pico-card-background-color) 100%);
}

.allocation-column.benefits .column-header {
  border-color: #2196f3;
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.1) 0%, var(--pico-card-background-color) 100%);
}

.column-header h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  line-height: 1.2;
}

@media (max-width: 768px) {
  .column-header h3 {
    font-size: 0.938rem;
  }
}

@media (max-width: 640px) {
  .column-header h3 {
    font-size: 0.875rem;
    margin: 0 0 0.188rem 0;
  }
}

.column-total {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 0.25rem 0;
  color: var(--pico-primary);
  word-break: break-word;
  line-height: 1.2;
}

@media (max-width: 768px) {
  .column-total {
    font-size: 1.25rem;
  }
}

@media (max-width: 640px) {
  .column-total {
    font-size: 1.125rem;
  }
}

.allocation-column.business-supplies .column-total {
  color: #4caf50;
}

.allocation-column.benefits .column-total {
  color: #2196f3;
}

.column-header small {
  color: var(--pico-muted-color);
  font-size: 0.75rem;
  line-height: 1;
  display: block;
  margin-top: 0.125rem;
}

.column-search {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.5rem;
  border: 2px solid var(--pico-muted-border-color);
  border-radius: 6px;
  font-size: 0.875rem;
  box-sizing: border-box;
}

.column-search:focus {
  border-color: var(--pico-primary);
  outline: none;
}

.business-supplies .column-search:focus {
  border-color: #4caf50;
}

.benefits .column-search:focus {
  border-color: #2196f3;
}


.cards-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow-x: visible;
  overflow-y: auto;
  padding: 5px 2px 0 2px;
}

.allocation-card {
  background: var(--pico-card-background-color);
  border: 3px solid #666;
  border-radius: 8px;
  padding: 0.625rem 0.75rem 0.5rem 0.5rem;
  margin-bottom: 0.75rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  transform: translateY(0);
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  box-sizing: border-box;
  position: relative;
  z-index: 0;
}

@media (max-width: 640px) {
  .allocation-card {
    padding: 0.625rem;
    border-radius: 4px;
  }
}

.business-supplies .allocation-card {
  border-left: 5px solid #4caf50;
}

.benefits .allocation-card {
  border-left: 5px solid #2196f3;
}

.allocation-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.allocation-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.375rem;
  margin-top: -8px;
  margin-right: -8px;
  margin-left: -8px;
  margin-bottom: 0.375rem;
}

@media (max-width: 768px) {
  .allocation-card header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

.allocation-card header strong {
  font-size: 0.875rem;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.allocation-card header small {
  color: var(--pico-muted-color);
  font-size: 0.75rem;
  white-space: nowrap;
}

.card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}
.card-meta-row .card-id {
  font-size: 0.688rem;
  color: var(--pico-muted-color);
  font-family: monospace;
  opacity: 0.7;
}
.card-meta-row .card-payment-method {
  font-size: 0.688rem;
  color: var(--pico-muted-color);
  font-family: monospace;
  opacity: 0.7;
  text-align: right;
}

.card-amount-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-amount-row .allocation-percentage {
  flex: 1;
}
.expand-toggle {
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--pico-muted-color);
  border-radius: 4px;
  margin: 0;
  min-width: auto;
  height: auto;
  line-height: 1;
}
.expand-toggle:hover {
  background: var(--pico-muted-border-color);
  color: var(--pico-primary);
}

.allocation-card.reviewed {
  opacity: 0.85;
}

.allocation-card.split-item {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.05) 0%, rgba(33, 150, 243, 0.05) 100%);
}

.business-supplies .allocation-card.split-item {
  border-left-color: #FFA726;
}

.benefits .allocation-card.split-item {
  border-left-color: #FFA726;
}

.card-amount {
  font-size: 1.125rem;
  font-weight: bold;
  margin: 0;
  color: var(--pico-primary);
  display: inline-block;
}

@media (max-width: 640px) {
  .card-amount {
    font-size: 1rem;
  }
}

.business-supplies .card-amount {
  color: #4caf50;
}

.benefits .card-amount {
  color: #2196f3;
}

.allocation-percentage {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: var(--pico-muted-color);
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .allocation-percentage {
    font-size: 0.688rem;
    margin-left: 0.25rem;
  }
}

.percentage-badge {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--pico-primary);
}

.business-supplies .percentage-badge {
  color: #4caf50;
}

.benefits .percentage-badge {
  color: #2196f3;
}

.preset-buttons {
  display: none;
}

.preset-buttons button {
  padding: 0.25rem 0.25rem;
  font-size: 0.688rem;
  font-weight: 600;
  border: 1px solid var(--pico-muted-border-color);
  background: var(--pico-card-background-color);
  cursor: pointer;
  border-radius: 3px;
  white-space: nowrap;
  text-align: center;
}

@media (max-width: 768px) {
  .preset-buttons {
    gap: 0.188rem;
  }
  .preset-buttons button {
    padding: 0.188rem 0.125rem;
    font-size: 0.625rem;
  }
}

@media (max-width: 480px) {
  .preset-buttons button {
    font-size: 0.563rem;
    padding: 0.125rem 0.063rem;
  }
}

.preset-buttons button:hover {
  background: var(--pico-primary-focus);
  border-color: var(--pico-primary);
}

.preset-buttons button.active {
  background: var(--pico-primary);
  color: white;
  border-color: var(--pico-primary);
}

.business-supplies .preset-buttons button.active {
  background: #4caf50;
  border-color: #4caf50;
}

.benefits .preset-buttons button.active {
  background: #2196f3;
  border-color: #2196f3;
}

.allocation-card footer {
  margin-top: 0.375rem;
  padding-top: 0.375rem;
  border-top: 1px solid var(--pico-muted-border-color);
}

.allocation-card footer button {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

.card-info {
  padding: 0.25rem 0.5rem;
  background: var(--pico-code-background-color);
  border-radius: 3px;
  margin: 0.375rem 0 0 0;
}

.card-info small {
  color: var(--pico-muted-color);
  font-size: 0.75rem;
  font-style: italic;
}

.empty-column {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--pico-muted-color);
  font-style: italic;
}

/* Bulk Allocation Modal */
.bulk-apply-modal {
  padding: 0;
  max-width: 600px;
  border: none;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.bulk-apply-modal article {
  margin: 0;
  padding: 0;
}

.bulk-apply-modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.bulk-apply-modal header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.bulk-apply-modal .close {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pico-muted-color);
  transition: color 0.2s;
}

.bulk-apply-modal .close:hover {
  color: var(--pico-color);
}

.bulk-apply-modal .modal-content {
  padding: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

.allocation-preview {
  background: var(--pico-card-background-color);
  padding: 1rem;
  border-radius: 6px;
  border-left: 4px solid var(--pico-primary);
  margin: 1rem 0;
}

.allocation-preview strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.business-badge,
.benefits-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-right: 0.5rem;
  margin-top: 0.5rem;
}

.business-badge {
  background: rgba(76, 175, 80, 0.15);
  color: #4caf50;
}

.benefits-badge {
  background: rgba(33, 150, 243, 0.15);
  color: #2196f3;
}

.matches-list {
  margin-top: 1.5rem;
}

.matches-list h4 {
  font-size: 0.875rem;
  color: var(--pico-muted-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.match-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--pico-card-background-color);
  border-radius: 6px;
  border: 1px solid var(--pico-muted-border-color);
}

.match-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.match-info strong {
  font-size: 0.9rem;
}

.match-info small {
  font-size: 0.75rem;
  color: var(--pico-muted-color);
}

.match-change {
  text-align: right;
  font-size: 0.875rem;
  white-space: nowrap;
  margin-left: 1rem;
}

.match-change .current {
  color: var(--pico-muted-color);
}

.match-change .new {
  color: var(--pico-primary);
  font-weight: 600;
}

.bulk-apply-modal footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.5rem;
  border-top: 1px solid var(--pico-muted-border-color);
}

.bulk-apply-modal footer button {
  margin: 0;
}

/* Modal backdrop */
dialog[open] {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
