:root {
  --bg: #0b0d10;
  --panel: #12151a;
  --panel2: #171b21;
  --line: #262c35;
  --text: #f4f7fb;
  --muted: #9ba6b5;
  --accent: #7c8cff;
  --danger: #ff6b6b;
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.35);
  --r: 18px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: linear-gradient(180deg, #0a0c0f, #10141a 55%, #0a0c0f);
  color: var(--text);
  font:
    15px/1.45 Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  min-height: 100vh;
}
.wrap {
  width: min(1100px, calc(100% - 24px));
  margin: 34px auto 70px;
}
.top {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}
h1 {
  font-size: clamp(28px, 4vw, 42px);
  margin: 0;
  letter-spacing: -0.04em;
}
.who {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}
.card {
  background: rgba(18, 21, 26, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.header,
.row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 154px minmax(220px, 1.2fr) 82px;
  gap: 14px;
  align-items: center;
}
.header {
  padding: 12px 18px;
  color: #7f8a99;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--line);
}
.row {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.row:last-child {
  border-bottom: 0;
}
.item-name {
  font-size: 16px;
  font-weight: 650;
  min-width: 0;
  word-break: break-word;
}
.counter {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
}
button {
  font: inherit;
}
.btn {
  height: 36px;
  border: 1px solid var(--line);
  background: #1a1f27;
  color: #fff;
  border-radius: 11px;
  cursor: pointer;
}
.btn:hover {
  background: #232a34;
}
.minus,
.plus {
  width: 36px;
  font-size: 20px;
  line-height: 1;
}
.count {
  min-width: 32px;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
}
.avatars {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
  align-items: center;
}
.person {
  position: relative;
  width: 38px;
  height: 38px;
}
.person img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  border: 2px solid #2d3440;
  background: #232831;
}
.badge {
  position: absolute;
  right: -5px;
  bottom: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #0c0f13;
  font-size: 11px;
  font-weight: 900;
  border: 2px solid var(--panel);
}
.sum {
  font-size: 20px;
  font-weight: 900;
  text-align: center;
}
.empty {
  color: #596574;
}
.new-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px 110px 120px auto;
  gap: 10px;
  padding: 14px 18px;
  align-items: end;
}
.field {
  display: grid;
  gap: 6px;
  position: relative;
}
.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: #11161d;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  z-index: 50;
  display: none;
  max-height: 280px;
  overflow-y: auto;
}
.suggestions.show {
  display: block;
}
.suggestion {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.suggestion:last-child {
  border-bottom: 0;
}
.suggestion:hover {
  background: #1d242d;
}
.suggestion-main {
  font-weight: 750;
}
.suggestion-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 800;
}
.req {
  color: #ff8b8b;
}
.opt {
  color: #66717f;
  font-weight: 700;
}
.price {
  color: #b9c1cc;
  font-size: 13px;
  font-weight: 700;
  margin-left: 8px;
}
.admin-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}
.admin-table th,
.admin-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: middle;
}
.admin-table th:last-child,
.admin-table td:last-child {
  border-right: 0;
}
.admin-table tr:last-child td {
  border-bottom: 0;
}
.admin-table th {
  background: #0f1318;
  color: #98a3b1;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
}
.admin-table input,
.admin-table select {
  height: 34px;
  min-width: 70px;
}
.admin-table .qty {
  width: 62px;
}
.admin-table .actions {
  white-space: nowrap;
}
.admin-table .user-head {
  min-width: 88px;
  text-align: center;
}
.admin-table .user-cell {
  text-align: center;
}
.admin-table .user-cell input {
  text-align: center;
  width: 62px;
}
.admin-table .name-col {
  min-width: 180px;
}
.admin-table .price-col {
  width: 100px;
}
input,
select {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0d1014;
  color: #fff;
  padding: 0 13px;
  outline: none;
}
input:focus,
select:focus {
  border-color: #596bff;
  box-shadow: 0 0 0 3px rgba(89, 107, 255, 0.12);
}
.add {
  padding: 0 16px;
  background: #eef1ff;
  color: #111521;
  font-weight: 800;
}
.admin-list {
  display: grid;
  gap: 8px;
}
.danger {
  color: #ffdede;
  border-color: #553038;
  background: #2a171b;
  padding: 0 12px;
}
.save {
  padding: 0 12px;
}
.notice {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}
.avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-backdrop.show {
  display: flex;
}
.modal {
  width: min(760px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #11151a;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  padding: 18px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.modal-head h3 {
  margin: 0;
  font-size: 20px;
}
.modal textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0b0e12;
  color: #fff;
  padding: 14px;
  font:
    14px/1.5 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}
@media (max-width: 760px) {
  .wrap {
    width: min(100% - 14px, 1100px);
    margin-top: 18px;
  }
  .top {
    align-items: flex-start;
    flex-direction: column;
  }
  .header {
    display: none;
  }
  .row {
    grid-template-columns: 1fr auto;
    gap: 10px 12px;
    padding: 14px;
  }
  .item-name {
    grid-column: 1/2;
  }
  .counter {
    grid-column: 2/3;
    grid-row: 1;
  }
  .avatars {
    grid-column: 1/2;
  }
  .sum {
    grid-column: 2/3;
    text-align: right;
    align-self: center;
  }
  .sum:before {
    content: "Σ ";
    color: var(--muted);
    font-size: 12px;
  }
  .new-row {
    grid-template-columns: 1fr 92px 92px;
    gap: 8px;
    padding: 12px;
  }
  .new-row .field:nth-child(4) {
    grid-column: 1/2;
  }
  .new-row .add {
    grid-column: 2/4;
  }
}

.trip-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px 24px;
  align-items: start;
  padding: 20px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #131c25, #10161d);
  font-size: 13px;
}
.summary-top {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
}
.summary-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  grid-column: 1;
  grid-row: 2;
  color: var(--muted);
  font-size: 12px;
}
.summary-stats b {
  color: var(--text);
  font-size: 14px;
  margin-right: 5px;
  font-variant-numeric: tabular-nums;
}
.summary-amounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  grid-column: 2;
  grid-row: 1 / 4;
  width: 100%;
  justify-self: end;
  align-self: stretch;
}
.summary-amount {
  padding: 14px;
  border: 1px solid #2b3948;
  border-radius: 12px;
  background: #141e28;
  min-width: 0;
}
.summary-amount span {
  display: block;
  color: #b5c1cf;
  font-size: 12px;
  font-weight: 650;
}
.summary-amount strong {
  display: block;
  margin-top: 7px;
  font-size: clamp(22px, 2.5vw, 28px);
  line-height: 1.2;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.summary-amount.featured {
  background: linear-gradient(135deg, #17392e, #152b28);
  border-color: #326a51;
}
.summary-amount.featured span {
  color: #b3dbc8;
}
.summary-amount.featured strong {
  color: #a9f0c5;
}
.summary-amount small {
  display: block;
  color: #a8bdb1;
  font-size: 11px;
  margin-top: 7px;
}
.summary-note {
  grid-column: 1;
  grid-row: 3;
  align-self: end;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}
.summary-warning {
  display: block;
  color: #f0cd92;
  margin-top: 4px;
}
.person:not(.inactive) img,
.participant-option:not(.inactive) img,
.who img.active {
  border: 2px solid #62d69a;
  box-shadow: 0 0 0 2px rgba(98, 214, 154, 0.12);
}
.who img.inactive {
  filter: grayscale(1);
  opacity: 0.45;
}
@media (max-width: 700px) {
  .trip-summary {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    gap: 12px;
  }
  .summary-top,
  .summary-stats,
  .summary-amounts,
  .summary-note {
    grid-column: 1;
    grid-row: auto;
    align-self: start;
  }
  .summary-amounts {
    max-width: 440px;
  }
}
@media (max-width: 480px) {
  .trip-summary {
    padding: 16px 12px;
  }
  .summary-amounts {
    grid-template-columns: 1fr;
    gap: 9px;
  }
  .summary-amount {
    padding: 14px;
  }
  .summary-amount.featured strong {
    font-size: 30px;
  }
  .summary-stats {
    gap: 8px 14px;
  }
}
.participants {
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
}
.participants legend {
  font-size: 13px;
  color: var(--muted);
  padding: 0 6px;
}
.participant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}
.participant-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-radius: 9px;
  background: #11161d;
  font-size: 13px;
  cursor: pointer;
}
.participant-option input {
  width: 17px;
  height: 17px;
  min-width: 17px;
  margin: 0;
  accent-color: #7caaef;
}
.participant-option span {
  overflow-wrap: anywhere;
}
.person.inactive {
  filter: grayscale(1);
  opacity: 0.45;
}
.counter.inactive,
.user-cell.inactive {
  opacity: 0.45;
}
.participant-option.inactive {
  color: var(--muted);
}
.participant-option.inactive img {
  filter: grayscale(1);
  opacity: 0.45;
}

#productForm {
  grid-template-columns: minmax(220px, 1fr) 96px 104px 164px 116px;
  gap: 14px 12px;
  padding: 18px;
  background: linear-gradient(110deg, #171e28, #141a22);
  border-top: 1px solid #303b4a;
  box-shadow: inset 3px 0 0 #7586cd;
  align-items: end;
}
#productForm .field {
  min-width: 0;
  gap: 8px;
  grid-column: auto;
}
#productForm label {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 650;
  color: #c2ccda;
}
#productForm .req {
  color: #a6b4dc;
}
#productForm .opt {
  color: #9ba6b5;
  font-size: 10px;
  font-weight: 500;
}
#productForm input,
#productForm select {
  height: 44px;
  font: inherit;
  font-size: 14px;
  background: #10151c;
  border-color: #344051;
  border-radius: 10px;
  padding: 0 11px;
  min-width: 0;
}
#productForm input::placeholder {
  color: #8491a4;
  opacity: 1;
}
#productForm .add {
  height: 44px;
  grid-column: auto;
  border: 1px solid #a9b6f1;
  background: #cdd7ff;
  color: #17223d;
  border-radius: 10px;
  white-space: nowrap;
  padding: 0 14px;
  font-size: 13px;
}
#productForm .add:hover {
  background: #e0e6ff;
  border-color: #d9e1ff;
}
#productForm .add:focus-visible {
  outline: 2px solid #a9b6f1;
  outline-offset: 3px;
}
@media (max-width: 900px) {
  #productForm {
    grid-template-columns: 1fr 1fr 1.4fr 1fr;
  }
  #productForm .product-name {
    grid-column: 1 / -1;
  }
  #productForm .product-price {
    grid-column: auto;
  }
  #productForm .add {
    grid-column: auto;
  }
}
@media (max-width: 540px) {
  #productForm {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding: 16px 12px;
    gap: 14px 10px;
  }
  #productForm .product-price {
    grid-column: 1;
  }
  #productForm .add {
    grid-column: 2;
  }
}
