/* Reusable page shell: header + .page-section with .section-heading and content. */
:root {
  --page-width: 1100px;
  --page-gap: 32px;
  --header-offset: 110px;
  scroll-padding-top: var(--header-offset);
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 17, 24, 0.96);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid #293342;
  box-shadow: 0 8px 24px #0003;
}
.header-inner {
  width: min(var(--page-width), calc(100% - 32px));
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px 24px;
  padding: 16px 0;
}
.site-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}
.site-brand h1 {
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: -0.04em;
  margin: 0;
}
.site-brand nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  flex-basis: 100%;
  margin-top: 5px;
}
.site-brand nav a {
  color: #a7b7cf;
  text-decoration: none;
  font-size: 12px;
  padding: 3px 0;
}
.site-brand nav a:hover {
  color: #e0e8ff;
}
.site-brand nav a:focus-visible {
  outline: 2px solid #879aff;
  outline-offset: 4px;
  border-radius: 2px;
}
.preview-label {
  font-size: 10px;
  color: #a7b7cf;
  border: 1px solid #354359;
  border-radius: 6px;
  padding: 2px 6px;
}
.account-panel {
  display: grid;
  justify-items: end;
  gap: 9px;
  min-width: 0;
  max-width: 100%;
}
.account-panel .who {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  max-width: 100%;
  gap: 8px;
  font-size: 13px;
  line-height: 28px;
  margin: 0;
}
.account-panel .who img {
  flex: none;
}
.account-panel .who strong {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e9eef8;
  font-size: 13px;
}
.account-panel .who > span {
  font-size: 12px;
  text-align: right;
  color: var(--muted);
  line-height: 1.4;
}
.account-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.account-actions .btn {
  height: 30px;
  padding: 0 10px;
  font-size: 11px;
  border-radius: 8px;
  white-space: nowrap;
}
.account-actions .edit-mode-bar {
  margin: 0;
  display: block;
}
.account-actions .edit-mode-bar[hidden] {
  display: none;
}
.account-actions:empty {
  display: none;
}
.btn[hidden],
.login-panel[hidden] {
  display: none;
}
.login-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(100px, 180px) auto;
  gap: 12px;
  align-items: end;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  max-width: 650px;
  width: 100%;
  justify-self: end;
}
.login-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}
.login-panel input,
.login-panel select {
  height: 38px;
  font-size: 13px;
  border-radius: 9px;
}
.login-panel .btn {
  height: 38px;
  padding: 0 14px;
}
.wrap {
  width: min(var(--page-width), calc(100% - 32px));
  margin: 28px auto 64px;
  display: grid;
  gap: var(--page-gap);
  min-width: 0;
}
.page-section {
  min-width: 0;
  scroll-margin-top: 16px;
}
.page-section.trip-plan {
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: none;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px;
  min-width: 0;
  flex-wrap: wrap;
}
.section-heading h2,
.section-heading.trip-heading h2 {
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.035em;
  margin: 0;
  font-weight: 750;
}
.section-heading .btn {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}
.trip-caption {
  color: #8697ae;
  font-size: 12px;
}
.trip-scroll {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 14px 20px;
  background: linear-gradient(135deg, #151e28, #11161d);
}
.trip-track {
  min-height: 102px;
}
.trip-message {
  margin: 10px 0 0;
  min-height: 0;
}
.trip-message:empty {
  display: none;
}
.trip-editor {
  border-top: 0;
  padding-top: 0;
  margin-top: 16px;
}
.trip-editor-head {
  margin-bottom: 12px;
}
.trip-editor-group {
  background: #111720;
}
.card {
  border-radius: 16px;
  min-width: 0;
  overflow: visible;
}
.card > .header {
  border-radius: 16px 16px 0 0;
  background: #151c25;
  padding: 12px 18px;
  font-size: 11px;
  color: #9baac0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.card .row {
  background: rgba(18, 21, 26, 0.7);
}
.card #items > .row:first-child {
  border-top: 1px solid var(--line);
}
#productForm {
  box-shadow: none;
  border-top: 1px solid var(--line);
}
.trip-summary {
  border-bottom: 0;
  border-radius: 0 0 16px 16px;
}
#saveStatus {
  font-size: 12px;
  color: var(--muted);
  margin: -4px 0 12px;
  overflow-wrap: anywhere;
}
#saveStatus:empty {
  display: none;
}
.list-empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.admin {
  margin-top: 18px;
  padding: 16px;
  border-radius: 16px;
  min-width: 0;
}
.admin-head {
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.admin-head h3 {
  font-size: 15px;
  margin: 0;
}
.admin-head > div {
  max-width: 100%;
  flex-wrap: wrap;
}
.admin-head .btn {
  font-size: 12px;
  padding: 0 12px;
}
.participants {
  margin-bottom: 16px;
}
.admin-table-wrap {
  max-width: 100%;
}
.admin-table {
  font-size: 12px;
}
.participant-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.participant-option {
  min-width: 0;
}
.modal {
  min-width: 0;
}
.modal-head {
  gap: 12px;
}
.modal-head h3 {
  font-size: 18px;
}
.modal-actions {
  flex-wrap: wrap;
}
.modal-actions .btn {
  padding: 0 14px;
}
@media (max-width: 820px) {
  .header,
  .row {
    grid-template-columns: minmax(160px, 1fr) 136px minmax(180px, 1fr) 54px;
    gap: 10px;
  }
}
@media (max-width: 760px) {
  :root {
    --page-gap: 26px;
  }
  .header-inner,
  .wrap {
    width: calc(100% - 24px);
  }
  .header-inner {
    gap: 12px;
    padding: 12px 0;
  }
  .wrap {
    margin-top: 22px;
    margin-bottom: 40px;
  }
  .card > .header {
    display: none;
  }
  .card .row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 16px 12px;
  }
  .item-name {
    font-size: 14px;
  }
  .price {
    display: block;
    margin: 5px 0 0;
    font-size: 12px;
  }
  .card .counter {
    grid-column: 2;
    grid-row: 1;
    gap: 5px;
  }
  .card .avatars {
    grid-column: 1;
    min-width: 0;
    gap: 10px;
  }
  .card .sum {
    grid-column: 2;
    grid-row: 2;
    text-align: right;
    align-self: center;
  }
  .minus,
  .plus {
    width: 34px;
  }
  .count {
    min-width: 24px;
    font-size: 15px;
  }
  .person,
  .person img {
    width: 34px;
    height: 34px;
  }
  .badge {
    font-size: 10px;
    min-width: 18px;
    height: 18px;
  }
  .section-heading {
    margin-bottom: 12px;
  }
  .section-heading h2,
  .section-heading.trip-heading h2 {
    font-size: 20px;
  }
  .trip-scroll {
    padding: 18px 10px 16px;
  }
  .trip-caption {
    font-size: 11px;
  }
  .admin {
    padding: 12px;
  }
  .account-panel .who strong {
    max-width: 175px;
  }
  .trip-stop-editor {
    grid-template-columns: minmax(0, 1fr) 100px 34px;
  }
}
@media (max-width: 480px) {
  .header-inner {
    grid-template-columns: minmax(85px, 1fr) minmax(0, 1.7fr);
    gap: 10px;
  }
  .site-brand h1 {
    font-size: 20px;
  }
  .site-brand nav {
    display: grid;
    gap: 4px;
    margin-top: 2px;
  }
  .site-brand nav a {
    font-size: 11px;
    padding: 2px 0;
  }
  .account-panel .who strong {
    max-width: 145px;
    font-size: 12px;
  }
  .account-panel .who {
    gap: 6px;
  }
  .account-panel .avatar-sm {
    width: 26px;
    height: 26px;
  }
  .account-actions {
    gap: 5px;
  }
  .account-actions .btn {
    font-size: 10px;
    padding: 0 8px;
    height: 28px;
  }
  .login-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }
  .login-panel .btn {
    grid-column: 1 / -1;
    height: 34px;
  }
  .summary-amounts {
    max-width: none;
  }
  .summary-note {
    font-size: 11px;
  }
  .participant-grid {
    grid-template-columns: 1fr;
  }
  .trip-editor-group {
    padding: 10px;
  }
  .trip-stop-editor {
    grid-template-columns: minmax(0, 1fr) 94px 30px;
    gap: 6px;
  }
  .trip-stop-editor input {
    padding: 0 7px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Destination and concise route labels. */
.route-outbound .route-direction {
  text-align: left;
  text-transform: none;
  letter-spacing: 0.02em;
  padding-left: 6px;
}
.route-inbound .route-direction {
  text-align: right;
  text-transform: none;
  letter-spacing: 0.02em;
  padding-right: 6px;
}
.place-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px 22px;
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #121923;
}
.place-photo {
  position: relative;
  aspect-ratio: 656 / 437;
  overflow: hidden;
  border-radius: 10px;
  background: #202c25;
  align-self: start;
}
/* Show only the photograph from the user-provided reference, without changing its pixels. */
.place-photo img {
  position: absolute;
  width: 249.695%;
  max-width: none;
  height: auto;
  left: -1.677%;
  top: -59.039%;
  display: block;
}
.place-description {
  min-width: 0;
}
.place-description h3 {
  font-size: 17px;
  line-height: 1.35;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.place-description p {
  font-size: 13px;
  line-height: 1.65;
  color: #b3bfd0;
  margin: 8px 0;
}
.place-description .place-location {
  font-size: 11px;
  color: #90a2ba;
  margin: 0 0 8px;
}
.place-description a {
  display: inline-block;
  margin-top: 9px;
  color: #b7c8ff;
  font-size: 12px;
  text-decoration: none;
}
.place-description a:hover {
  text-decoration: underline;
}
.place-description a:focus-visible {
  outline: 2px solid #879aff;
  outline-offset: 4px;
}
.place-amenities {
  grid-column: 1 / -1;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 14px 12px;
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}
.place-amenities li {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  color: #aebed1;
  font-size: 11px;
  line-height: 1.5;
}
.place-amenities svg {
  width: 25px;
  height: 25px;
  flex: none;
  color: #c9d8ef;
}
.summary-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: baseline;
}
.summary-participants b {
  margin: 0;
}
.summary-participants > span {
  color: var(--muted);
  font-size: 10px;
}
@media (max-width: 900px) {
  .place-amenities {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .place-card {
    grid-template-columns: 160px minmax(0, 1fr);
    padding: 14px;
    gap: 14px;
  }
  .place-amenities {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .place-card {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .place-photo {
    width: 160px;
  }
  .place-description h3 {
    font-size: 16px;
  }
  .place-description p {
    font-size: 12px;
  }
  .place-amenities {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 8px;
  }
}

/* Match the photograph to the adjacent description, keeping its reference crop. */
.place-photo {
  aspect-ratio: auto;
  align-self: stretch;
  min-height: 146px;
}
.place-photo img {
  width: auto;
  height: 163.844%;
  min-width: 249.695%;
  left: 50%;
  top: -59.039%;
  transform: translateX(-20.695%);
}
@media (max-width: 480px) {
  .place-card {
    grid-template-columns: minmax(90px, 30%) minmax(0, 1fr);
  }
  .place-photo {
    width: auto;
    min-height: 0;
  }
}

[hidden] {
  display: none !important;
}
.login-panel > h2,
.login-panel > p {
  display: none;
}
.logged-out {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at top, #222e46, #0d1118 70%);
}
.logged-out .site-header {
  position: static;
  background: none;
  border: 0;
  box-shadow: none;
  width: min(100% - 32px, 420px);
}
.logged-out .header-inner {
  display: block;
  padding: 0;
}
.logged-out .site-brand,
.logged-out .account-panel {
  display: none;
}
.logged-out .login-panel {
  display: grid;
  grid-template-columns: 1fr;
  max-width: none;
  border-top: 1px solid #364259;
  gap: 18px;
  background: #171e29;
  border: 1px solid #364259;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 24px 90px #0006;
  width: 100%;
  box-sizing: border-box;
}
.logged-out .login-panel > h2,
.logged-out .login-panel > p {
  display: block;
  margin: 0;
}
.logged-out .login-panel > p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}
.logged-out .login-panel label {
  display: grid;
  gap: 8px;
}
.logged-out .login-panel input {
  width: 100%;
  height: 46px;
  box-sizing: border-box;
}
.logged-out .login-panel button {
  height: 46px;
}
.logged-out #saveStatus {
  position: fixed;
  bottom: 24px;
  left: 16px;
  right: 16px;
  text-align: center;
}

/* Account controls remain beside the signed-in name. */
.account-panel {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.account-actions {
  flex-wrap: nowrap;
  gap: 8px;
}
/* Equal timeline cells fit the desktop width; the stay spans adjacent dots. */
.trip-scroll {
  overflow-x: visible;
}
.trip-track {
  width: 100%;
  min-width: 0;
  gap: 0;
}
.route-group {
  display: contents;
}
.route-direction {
  top: 0;
  left: 0;
  right: auto;
  max-width: 48%;
}
.route-inbound .route-direction {
  left: auto;
  right: 0;
}
.route-stop,
.route-stay {
  box-sizing: border-box;
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  margin-top: 30px;
  padding: 30px 4px 0;
}
.route-stop:before {
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  left: calc(50% - 7px);
}
.trip-track:before {
  top: 42px;
  left: calc(50% / var(--nodes, 3));
  right: calc(50% / var(--nodes, 3));
}
.route-stay:before {
  box-sizing: border-box;
  left: -50%;
  width: 200%;
  top: 10px;
  height: 4px;
  border: 0;
  border-radius: 0;
  background: #62d69a;
  box-shadow: none;
  z-index: -1;
}
.route-place {
  font-size: clamp(8px, calc(18px - var(--nodes, 3) * 0.7px), 13px);
}
.route-time {
  font-size: clamp(9px, calc(22px - var(--nodes, 3) * 0.7px), 18px);
}
.route-stay .route-time {
  font-size: clamp(8px, calc(16px - var(--nodes, 3) * 0.5px), 12px);
}
@media (max-width: 760px) {
  .trip-scroll {
    overflow-x: auto;
  }
  .trip-track {
    width: max-content;
    min-width: 100%;
  }
  .route-stop,
  .route-stay {
    flex: 1 0 112px;
    min-width: 112px;
    max-width: none;
  }
  .route-place {
    font-size: 12px;
  }
  .route-time {
    font-size: 16px;
  }
  .route-stay .route-time {
    font-size: 12px;
  }
}
@media (max-width: 480px) {
  .account-panel {
    gap: 8px;
    flex-wrap: wrap;
  }
  .account-actions {
    gap: 6px;
  }
}

/* Compact administrator editor: per-person quantities expand inside one cell. */
.admin-table {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}
.admin-table th:nth-child(1) {
  width: 25%;
}
.admin-table th:nth-child(2) {
  width: 10%;
}
.admin-table th:nth-child(3) {
  width: 12%;
}
.admin-table th:nth-child(4) {
  width: 11%;
}
.admin-table th:nth-child(5) {
  width: 24%;
}
.admin-table th:nth-child(6) {
  width: 18%;
}
.admin-table .name-col {
  min-width: 0;
}
.admin-table .price-col {
  width: auto;
}
.admin-table input,
.admin-table select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.admin-table .actions {
  white-space: normal;
}
.admin-table .actions .btn {
  height: 30px;
  padding: 0 8px;
  font-size: 11px;
  margin: 2px 0;
}
.admin-quantities summary {
  cursor: pointer;
  font-size: 11px;
  color: #bacbe1;
  list-style-position: inside;
}
.admin-user-quantities {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.admin-user-quantity {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.admin-user-quantity img {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}
.admin-table .user-cell input {
  width: 100%;
  min-width: 0;
  max-width: 65px;
  text-align: center;
  padding: 0 4px;
  font-size: 11px;
}
.admin-table-wrap {
  overflow: visible;
}
.admin-table td {
  overflow-wrap: anywhere;
}
@media (max-width: 640px) {
  .admin-table thead {
    display: none;
  }
  .admin-table,
  .admin-table tbody {
    display: block;
  }
  .admin-table tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
  }
  .admin-table td {
    display: block;
    padding: 0;
    border: 0;
  }
  .admin-table .name-col {
    grid-column: 1 / -1;
  }
  .admin-table .admin-quantities {
    grid-column: 1 / -1;
  }
  .admin-table .actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }
  .admin-table td:nth-child(2):before {
    content: "Ilość";
  }
  .admin-table td:nth-child(3):before {
    content: "Jednostka";
  }
  .admin-table td:nth-child(4):before {
    content: "Cena ~";
  }
  .admin-table td:nth-child(2):before,
  .admin-table td:nth-child(3):before,
  .admin-table td:nth-child(4):before {
    display: block;
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 5px;
  }
  .admin-user-quantities {
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  }
}

.admin-quantities details {
  min-width: 0;
  max-width: 100%;
}
.admin-user-quantities {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  gap: 10px;
  padding: 2px 2px 10px;
  overscroll-behavior-x: contain;
}
.admin-user-quantity {
  flex: 0 0 48px;
  flex-direction: column;
  gap: 6px;
}
.admin-table .admin-user-quantity input {
  width: 48px;
  max-width: 48px;
}
.admin-user-quantity img {
  width: 28px;
  height: 28px;
}
.admin-table-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.admin-table-footer > span {
  margin-right: auto;
  font-size: 12px;
  color: #a9b9ce;
}
.admin-table input.admin-field-changed,
.admin-table select.admin-field-changed {
  border-color: #d6b66a;
  background: #332d20;
  box-shadow: 0 0 0 1px #d6b66a44;
}
.admin-row-changed {
  background: #24251d;
}
.admin-row-deleted {
  background: #34212a;
  opacity: 0.65;
}
.admin-row-deleted .name-col input {
  text-decoration: line-through;
}
.admin-recount {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  color: #b4c7e1;
  cursor: pointer;
}
.admin-table .admin-recount input {
  width: 14px;
  height: 14px;
  min-width: 0;
  accent-color: #8fbba1;
}
.admin-recount svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.admin-recount:has(input:checked) {
  color: #8ee1b2;
}
@media (max-width: 480px) {
  .admin-table-footer {
    flex-wrap: wrap;
  }
  .admin-table-footer > span {
    flex-basis: 100%;
  }
}

.admin-table th:nth-child(1) {
  width: 26%;
}
.admin-table th:nth-child(2) {
  width: 10%;
}
.admin-table th:nth-child(3) {
  width: 12%;
}
.admin-table th:nth-child(4) {
  width: 11%;
}
.admin-table th:nth-child(5) {
  width: auto;
}
.admin-table th:nth-child(6) {
  width: 40px;
}
.admin-table .admin-user-quantities {
  margin-top: 0;
}
.admin-table td.actions {
  text-align: center;
}
.admin-table .actions .admin-delete-icon {
  width: 28px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.admin-delete-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 640px) {
  .admin-table .actions {
    grid-column: 3;
    justify-content: flex-end;
  }
}

.admin-table th:nth-child(1) {
  width: clamp(120px, 18vw, 180px);
}
.admin-table th:nth-child(2) {
  width: 68px;
}
.admin-table th:nth-child(3) {
  width: 74px;
}
.admin-table th:nth-child(4) {
  width: 76px;
}
.admin-table th:nth-child(6) {
  width: 34px;
}
.admin-table td,
.admin-table th {
  padding: 6px;
}
.admin-table .admin-user-quantity {
  flex-basis: 42px;
}
.admin-table .admin-user-quantity input {
  width: 42px;
}
.admin-user-quantities {
  gap: 6px;
}
/* One aligned user strip: avatars once, fields below, one shared scrollbar. */
.admin-table input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
.admin-table input[type="number"]::-webkit-inner-spin-button,
.admin-table input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.admin-table {
  display: table;
  table-layout: fixed;
}
.admin-table thead {
  display: table-header-group;
}
.admin-table tbody {
  display: table-row-group;
}
.admin-table tbody tr {
  display: table-row;
  padding: 0;
}
.admin-table td,
.admin-table th {
  display: table-cell;
  padding: 6px;
  vertical-align: middle;
}
.admin-table th:nth-child(n) {
  width: auto;
}
.admin-table td:nth-child(n):before {
  display: none;
}
.admin-table .actions {
  display: table-cell;
}
.admin-user-header,
.admin-table .admin-user-quantities {
  display: flex;
  gap: 6px;
  overflow: hidden;
  flex-wrap: nowrap;
  max-width: 100%;
  padding: 0;
  margin: 0;
  min-width: 0;
  scrollbar-width: none;
}
.admin-user-header > span,
.admin-table .admin-user-quantity {
  width: var(--admin-user-cell, 40px);
  flex: 0 0 var(--admin-user-cell, 40px);
  display: flex;
  justify-content: center;
  align-items: center;
}
.admin-user-header img {
  width: 27px;
  height: 27px;
  object-fit: cover;
  border-radius: 50%;
}
.admin-table .admin-user-quantity input {
  width: 100%;
  max-width: none;
}
.admin-quantity-scroll {
  height: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  margin-top: 2px;
  overscroll-behavior-x: contain;
}
.admin-quantity-scroll > div {
  height: 1px;
}
.admin-quantity-scroll:focus-visible {
  outline: 1px solid #8da8cd;
  border-radius: 4px;
}
.preview-logged-out {
  margin: 80px auto;
  text-align: center;
}
.admin-table .name-col {
  min-width: 0;
}
.admin-table th {
  font-size: 10px;
  letter-spacing: 0;
}
.admin-table select {
  padding: 0 3px;
}
.admin-table .actions .admin-delete-icon {
  width: 24px;
}

.admin-table input.admin-zero-quantity {
  color: #657184;
}
.admin-table input.admin-zero-quantity:focus {
  color: #b5c1d2;
}
.owner-item-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  padding: 4px;
  margin-left: 7px;
  vertical-align: middle;
}
.owner-item-edit svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.owner-item-form {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 85px 75px 85px auto;
  gap: 8px;
  align-items: end;
}
.owner-item-form label {
  display: grid;
  gap: 4px;
  font-size: 10px;
  color: #aabbd0;
}
.owner-item-form input,
.owner-item-form select {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  height: 34px;
  padding: 0 6px;
  font-size: 12px;
}
.owner-item-actions {
  display: flex;
  gap: 5px;
}
.owner-item-actions .btn {
  width: 30px;
  height: 34px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.owner-item-save {
  color: #a4e8bf;
}
.owner-item-error {
  grid-column: 1 / -1;
  font-size: 11px;
  color: #f0a4ac;
  margin: 0;
}
.owner-item-form:has(input) {
  font-weight: 400;
}
@media (max-width: 900px) {
  .owner-item-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .owner-item-form label:first-child {
    grid-column: 1 / -1;
  }
  .owner-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

/* Edit the existing value line in place, without a second set of labels. */
.owner-item-form {
  display: flex;
  position: relative;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  margin: 0;
  font: inherit;
  min-width: 0;
  padding: 0;
}
.owner-item-form input,
.owner-item-form select {
  height: 29px;
  font: inherit;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 5px;
  min-width: 0;
}
.owner-item-form .owner-name-field {
  flex: 1 1 110px;
  width: 110px;
  font-weight: 650;
}
.owner-item-form .owner-amount-field {
  flex: 0 1 40px;
  width: 40px;
}
.owner-item-form .owner-unit-field {
  flex: 0 0 52px;
  width: 52px;
  padding: 2px 1px;
}
.owner-item-form .owner-price-field {
  flex: 0 1 54px;
  width: 54px;
}
.owner-price-prefix,
.owner-price-suffix {
  font-size: 12px;
  color: #b9c1cc;
  flex: none;
}
.owner-item-form .owner-item-actions {
  display: inline-flex;
  flex: none;
  gap: 3px;
  margin-left: 2px;
}
.owner-item-form .owner-item-actions .btn {
  width: 23px;
  height: 29px;
  padding: 0;
  font-size: 21px;
  line-height: 1;
  border: 0;
  background: transparent;
}
.owner-item-form .owner-item-error:empty {
  display: none;
}
.owner-item-form .owner-item-error:not(:empty) {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 5;
  padding: 5px 8px;
  background: #251b23;
  border-radius: 5px;
  max-width: 100%;
  font-size: 11px;
}
.owner-item-edit {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  width: 23px;
  height: 25px;
  padding: 0;
  vertical-align: middle;
  color: #b6c7e1;
  flex: none;
}
.owner-item-edit:hover {
  color: #fff;
}
.owner-pencil {
  display: block;
  position: relative;
  box-sizing: border-box;
  width: 5px;
  height: 15px;
  border: 1.5px solid currentColor;
  transform: rotate(42deg);
  border-radius: 1px;
  margin: 0 auto;
}
.owner-pencil:before {
  content: "";
  position: absolute;
  top: -4px;
  left: -1.5px;
  width: 5px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}
.owner-pencil:after {
  content: "";
  position: absolute;
  left: -1.5px;
  bottom: -5px;
  border-left: 2.5px solid transparent;
  border-right: 2.5px solid transparent;
  border-top: 4px solid currentColor;
}
.owner-item-form input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}
.owner-item-form input[type="number"]::-webkit-inner-spin-button,
.owner-item-form input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.owner-item-form .owner-item-cancel {
  color: #f17787;
  position: relative;
}
.owner-cancel-symbol {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
}
.owner-cancel-symbol:before,
.owner-cancel-symbol:after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 17px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}
.owner-cancel-symbol:after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.product-audience {
  display: block;
  width: fit-content;
  margin: 0 0 5px;
  padding: 2px 7px;
  border: 1px solid #3a485d;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  color: #9fb1ca;
}
.product-audience.is-shared {
  color: #a7d8bc;
  border-color: #426653;
  background: #193026;
}
.admin-table .sharing-col select {
  font-size: 11px;
}

.shopping-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r, 16px);
  background: #131d29;
}
.shopping-tools-copy {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}
.shopping-tools-copy strong {
  display: block;
  font-size: 14px;
  color: #e1eaf6;
}
.shopping-tools-copy div > span {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
.shopping-tools-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  background: #203345;
  border-radius: 11px;
  color: #9ac8b2;
}
.shopping-tools svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.shopping-tools .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex: none;
  height: 40px;
  padding: 0 15px;
  background: #244536;
  border-color: #48715a;
  color: #d3f0df;
}
.shopping-tools .btn:hover {
  background: #2e5643;
}
@media (max-width: 640px) {
  .shopping-tools {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }
  .shopping-tools .btn {
    width: 100%;
  }
}

#shoppingSection .card > .header,
#shoppingSection #items > .row {
  grid-template-columns: minmax(180px, 1fr) 58px 154px minmax(180px, 1.2fr) 82px;
}
.audience-heading {
  text-align: center;
  font-size: 9px;
  line-height: 1.4;
}
.product-audience-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  justify-self: center;
  color: #9babc2;
  border: 1px solid #3a485c;
  border-radius: 8px;
  background: #17202d;
  cursor: help;
}
.product-audience-icon.is-shared {
  color: #acd8bf;
  border-color: #426653;
  background: #193026;
}
.product-audience-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.product-audience-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 210px;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1px solid #52657e;
  border-radius: 8px;
  background: #0e1724;
  color: #e2ebf8;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
  z-index: 40;
  box-shadow: 0 5px 18px #0005;
  pointer-events: none;
}
.product-audience-tooltip {
  display: block;
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 0.12s ease,
    visibility 0s linear 0.12s;
}
.product-audience-icon:hover .product-audience-tooltip {
  visibility: visible;
  opacity: 1;
  transition-delay: 0.45s, 0.45s;
}
@media (min-width: 761px) and (max-width: 950px) {
  #shoppingSection .card > .header,
  #shoppingSection #items > .row {
    grid-template-columns: minmax(140px, 1fr) 40px 126px minmax(120px, 1fr) 54px;
    gap: 10px;
  }
}
@media (max-width: 760px) {
  #shoppingSection #items > .row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 10px;
  }
  #items .product-audience-icon {
    grid-column: 1;
    grid-row: 1;
  }
  #items .item-name {
    grid-column: 2;
    grid-row: 1;
  }
  #items .counter {
    grid-column: 3;
    grid-row: 1;
  }
  #items .avatars {
    grid-column: 1 / 3;
    grid-row: 2;
  }
  #items .sum {
    grid-column: 3;
    grid-row: 2;
  }
  .product-audience-tooltip {
    left: 0;
    transform: none;
  }
}

#items > .owner-row-editing {
  position: relative;
  box-sizing: border-box;
}
.owner-row-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  padding: 16px 18px;
  background: #1a2735;
  border: 1px solid #668aab;
  box-shadow: inset 3px 0 #8bacc8;
  box-sizing: border-box;
}
.owner-row-overlay .owner-item-form {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 115px 90px 110px 205px auto;
  gap: 12px;
  width: 100%;
  align-items: end;
}
.owner-row-overlay .owner-overlay-field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  font-size: 11px;
  color: #b9c9dd;
  white-space: nowrap;
}
.owner-row-overlay .owner-item-form input,
.owner-row-overlay .owner-item-form select {
  width: 100%;
  height: 36px;
  min-width: 0;
  flex: none;
  font-size: 13px;
  background: #101b28;
  color: #e1ebf8;
  border: 1px solid #425872;
  padding: 5px 8px;
}
.owner-row-overlay .owner-item-actions {
  margin: 0;
  grid-column: auto;
  align-self: end;
  height: 36px;
  align-items: center;
}
.owner-row-overlay .owner-item-actions .btn {
  width: 32px;
  height: 36px;
}
.owner-row-overlay .owner-item-error:not(:empty) {
  position: static;
  grid-column: 1 / -1;
  margin: 0;
}
@media (max-width: 1000px) {
  .owner-row-overlay .owner-item-form {
    grid-template-columns: minmax(140px, 1fr) 100px 80px 100px;
  }
  .owner-row-overlay .owner-overlay-field:has(.owner-sharing-field) {
    grid-column: 1 / 3;
  }
  .owner-row-overlay .owner-item-actions {
    grid-column: 3 / 5;
    justify-content: flex-end;
  }
}
@media (max-width: 600px) {
  .owner-row-overlay {
    padding: 12px;
  }
  .owner-row-overlay .owner-item-form {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .owner-row-overlay .owner-overlay-field:has(.owner-name-field) {
    grid-column: 1 / -1;
  }
  .owner-row-overlay .owner-overlay-field:has(.owner-sharing-field) {
    grid-column: auto;
  }
  .owner-row-overlay .owner-item-actions {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1001px) {
  .owner-row-overlay {
    padding: 7px 18px;
  }
  .owner-row-overlay .owner-overlay-field {
    gap: 3px;
    font-size: 10px;
  }
  .owner-row-overlay .owner-item-form input,
  .owner-row-overlay .owner-item-form select {
    height: 30px;
  }
  .owner-row-overlay .owner-item-actions,
  .owner-row-overlay .owner-item-actions .btn {
    height: 30px;
  }
}
