﻿* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f7fb;
  color: #172033;
}

.container {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 50px;
}

.app-header {
  text-align: center;
  margin-bottom: 24px;
}

.app-header h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.app-header p {
  margin: 0;
  color: #5f6b7a;
}

.card {
  background: #ffffff;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 5px 20px rgba(20, 40, 80, 0.08);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 20px;
}

.person-row,
.item-card {
  border: 1px solid #dfe5ee;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}

.person-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cfd7e3;
  border-radius: 8px;
  font-size: 16px;
}

.item-card h3 {
  margin: 0 0 12px;
}

.item-top {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 10px;
  margin-bottom: 14px;
}

.consumers-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.consumer-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.consumer-option {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px;
  background: #f5f7fa;
  border-radius: 7px;
}

button {
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  background: #1769e0;
  color: white;
}

.secondary-button {
  background: #edf2f8;
  color: #26364d;
}

.remove-button {
  background: #fff0f0;
  color: #b42318;
  padding: 8px 11px;
}

.message {
  margin-top: 12px;
  color: #b42318;
  font-weight: 600;
}

.hidden {
  display: none;
}

.result-card h2 {
  margin-bottom: 18px;
}

.result-person {
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.result-person h3 {
  margin: 0 0 12px;
  font-size: 20px;
}

.result-items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-item {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 7px 0;
  border-bottom: 1px solid #edf0f4;
}

.result-item:last-child {
  border-bottom: 0;
}

.person-total {
  text-align: right;
  margin-top: 12px;
  font-size: 18px;
  font-weight: 700;
}

.total-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #eef5ff;
  border-radius: 12px;
  padding: 18px;
  margin-top: 20px;
  font-size: 18px;
}

.total-box strong {
  font-size: 22px;
}

.result-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.print-header {
  display: none;
}

@media (max-width: 600px) {
  .container {
    width: min(100% - 20px, 900px);
    padding-top: 20px;
  }

  .card {
    padding: 18px;
  }

  .app-header h1 {
    font-size: 25px;
  }

  .item-top {
    grid-template-columns: 1fr;
  }

  .person-row {
    flex-wrap: wrap;
  }
}

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

  body {
    background: #ffffff;
    color: #000000;
  }

  .container {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  .result-card {
    display: block !important;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  .print-header {
    display: block;
    text-align: center;
    margin-bottom: 25px;
  }

  .print-header h1 {
    margin: 0 0 5px;
    font-size: 24px;
  }

  .print-header p {
    margin: 0;
    color: #555;
  }

  .result-person {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .total-box {
    break-inside: avoid;
    page-break-inside: avoid;
    background: #f2f2f2;
    border: 1px solid #ddd;
  }
}

@media print {
  .app-header {
    display: none !important;
  }
}

.item-card {
  position: relative;
}

.remove-item-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #dfe5ee;
  border-radius: 7px;
  background: #ffffff;
  color: #667085;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
}

.remove-item-button:hover {
  background: #fff0f0;
  color: #b42318;
  border-color: #f2caca;
}

