:root {
  --bg: #f7f5ef;
  --card: #ffffff;
  --text: #17212b;
  --muted: #5d6974;
  --accent: #0b6b4d;
  --accent-strong: #09573f;
  --border: #dce2e8;
  --danger: #b42318;
}

@font-face {
  font-family: "dreaming-outloud-pro-script";
  src:
    local("dreaming-outloud-pro-script"),
    url("./dreaming-outloud-pro-script.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% -10%, #e6f7ef, transparent 40%),
    radial-gradient(circle at 80% -20%, #fff1d9, transparent 45%),
    var(--bg);
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
}

.layout {
  flex: 1;
}

.site-header {
  width: min(1100px, 95vw);
  margin: 0.45rem auto 0.55rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.75rem 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  cursor: pointer;
}

.club-logo {
  display: block;
  max-height: 58px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
}

.site-header h1 {
  margin: 0;
  font-family: "dreaming-outloud-pro-script", "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
  font-size: clamp(1.8rem, 3.2vw, 2.45rem);
  letter-spacing: 0.01em;
}

#home-title {
  cursor: pointer;
}

.tabs {
  width: auto;
  margin: 0 0 0 auto;
  display: flex;
  gap: 0.2rem;
  border-bottom: 0;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.tab {
  border: 0;
  border-radius: 10px;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 0.85rem;
  background: transparent;
  color: #253647;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.tab:hover {
  background: #f5f9fc;
  color: #1b2b3c;
}

.tab-icon {
  width: 1.05rem;
  height: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.tab-icon-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: #8ebea8;
  background: #eef8f3;
}

.layout {
  width: min(1100px, 95vw);
  margin: 0 auto 0.7rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1rem 1rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.tab-panel[data-panel="settings"],
.tab-panel[data-panel="stats"],
.tab-panel[data-panel="about"] {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.tab-panel[data-panel="sales"] {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.tab-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.panel-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.stats-header-row .panel-heading-row {
  display: flex;
}

.demo-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
  flex: 0 0 auto;
  margin-left: auto;
}

.sales-middle h3,
.sales-right h3 {
  margin: 0 0 0.45rem;
  font-size: 2rem;
  font-weight: 650;
  line-height: 1.15;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.stack {
  display: grid;
  gap: 0.75rem;
}

.settings-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1rem 1rem;
  margin: 0 0 0.85rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.settings-section h3 {
  margin: 0 0 0.55rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 1.02rem;
}

input,
select {
  width: 100%;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  min-height: 44px;
  background: #fff;
}

input:disabled,
select:disabled {
  background: #e9eef3;
  color: #6c7a88;
  border-color: #c7d1db;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 640;
  font-size: 1.02rem;
  min-height: 44px;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.secondary {
  background: #737f8b;
}

#clear-cart {
  background: #fff6f6;
  color: #95231d;
  border: 1px solid #e5b1ac;
}

#clear-cart:hover {
  background: #fdeceb;
}

.row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.product-form {
  margin: 0.75rem 0 0.7rem;
}

.reset-default-btn {
  margin-top: 0.25rem;
  background: var(--danger);
  color: #fff;
  border: 1px solid #9d1b13;
}

.reset-default-btn:hover {
  background: #981911;
}

.product-help {
  margin: 0.15rem 0 0.35rem;
  color: #556474;
  font-size: 0.95rem;
}

.product-editing-banner {
  border: 1px solid #b9d6c6;
  background: #eef8f3;
  color: #274c3e;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font-size: 0.95rem;
}

.list {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.list li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.55rem;
  gap: 0.5rem;
}

.product-item.editing {
  border-color: #7eb89c;
  background: #f4fbf7;
}

.product-actions {
  margin-left: auto;
  justify-content: flex-end;
  width: auto;
  flex-wrap: nowrap;
  gap: 0.35rem;
}

.product-actions button {
  min-height: 34px;
  padding: 0.35rem 0.55rem;
  font-size: 0.88rem;
}

.product-move-btn {
  min-width: 34px;
  padding: 0.35rem 0.4rem;
  font-size: 1rem;
}

.product-item.dragging {
  opacity: 0.6;
}

.product-item.drag-over {
  outline: 2px dashed #7aa891;
  outline-offset: 2px;
}

.product-item-text {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  flex: 1 1 220px;
  min-width: 0;
}

.product-main {
  display: grid;
  gap: 0.1rem;
}

.product-main strong {
  font-size: 1rem;
  line-height: 1.2;
}

.product-meta {
  color: #5d6e7f;
  font-size: 0.9rem;
}

.category-form {
  align-items: end;
  margin: 0.35rem 0 0.55rem;
}

.category-name-wrap {
  flex: 1 1 240px;
}

.categories-list .category-item {
  align-items: center;
}

.category-item-text {
  display: grid;
  gap: 0.05rem;
}

.category-meta {
  color: #627487;
  font-size: 0.9rem;
}

.drag-handle {
  min-height: 30px;
  width: 30px;
  padding: 0;
  border-radius: 6px;
  background: #eff4f8;
  color: #3e4f60;
  border: 1px solid #ccd7e2;
  cursor: grab;
}

.drag-handle:hover {
  background: #e5edf4;
}

.sales-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) 300px;
  gap: 1.35rem;
  align-items: stretch;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1rem 1rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.sales-groups {
  display: grid;
  gap: 0.45rem;
}

.sales-category h4,
.custom-amount-toggle {
  margin: 0.15rem 0 0.35rem;
  padding: 0.16rem 0.45rem 0.2rem;
  font-size: 1rem;
  font-weight: 620;
  line-height: 1.1;
  color: #405364;
  border: 1px solid #d7dde4;
  border-radius: 8px;
  background: #eceff3;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
}

.sale-btn {
  height: 78px;
  padding: 0.45rem 0.6rem;
  font-size: 1.03rem;
  font-weight: 620;
  line-height: 1.2;
  white-space: pre-line;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.custom-amount-box {
  margin-top: 0.9rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  max-width: 520px;
}

.custom-amount-box.collapsed {
  padding: 0;
}

.custom-amount-toggle {
  width: 100%;
  margin: 0;
  min-height: 0;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  justify-content: flex-start;
}

.custom-amount-toggle:hover {
  background: #e7ebf0;
  color: #33475a;
}

.custom-amount-arrow {
  font-size: 0.82rem;
  line-height: 1;
}

.custom-amount-content {
  margin-top: 0.35rem;
}

.custom-amount-form {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(130px, 170px) auto;
  gap: 0.55rem;
  align-items: end;
}

#custom-submit {
  min-height: 46px;
  padding: 0.45rem 0.75rem;
  width: auto;
  font-size: 0.95rem;
  white-space: nowrap;
  justify-self: start;
}

.sales-left {
  max-height: 72vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.75rem;
}

.sales-right {
  align-self: start;
}

.sales-middle {
  border-left: 1px solid #dfe6ed;
  padding-left: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.42rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 1.03rem;
}

th {
  font-weight: 650;
}

.num {
  text-align: right;
}

.cart-table th:nth-child(2),
.cart-table td:nth-child(2) {
  width: 42px;
}

.cart-table th:nth-child(3),
.cart-table td:nth-child(3) {
  width: 88px;
  white-space: nowrap;
}

.cart-table th:nth-child(4),
.cart-table td:nth-child(4) {
  width: 44px;
  padding-left: 0;
  padding-right: 0;
}

.cart-table th:nth-child(1),
.cart-table td:nth-child(1) {
  width: 100%;
  min-width: 0;
}

.cart-table td:nth-child(4) .icon-x {
  margin-left: auto;
}

.cart-table tbody tr:last-child td {
  border-bottom: 0;
}

.total-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 42px 88px 40px;
  margin: 0.35rem 0 0.85rem;
  padding-top: 0.55rem;
  border-top: 2px solid #c8d1da;
}

.total-row::before {
  content: none;
}

.total-row strong {
  grid-column: 1;
  font-size: 2rem;
  font-weight: 700;
}

.total-row span {
  grid-column: 3;
  text-align: right;
  font-size: 2rem;
  font-weight: 700;
  white-space: nowrap;
}

.cart-undo {
  margin-top: 0.55rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid #d7dee6;
  border-radius: 10px;
  background: #f7fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.cart-undo button {
  min-height: 34px;
  padding: 0.35rem 0.6rem;
  font-size: 0.92rem;
}

.qr-block {
  margin-top: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flip-qr-btn {
  order: 2;
  margin: 0.55rem 0 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 36px;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  background: #eef2f6;
  color: #23384d;
  border: 1px solid #cbd6e1;
}

.flip-qr-btn:hover {
  background: #e2eaf2;
}

.swish-panel {
  width: min(265px, 100%);
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  transition: transform 240ms ease;
}

.swish-panel.flipped {
  transform: rotate(180deg);
}

.swish-panel-top {
  background: linear-gradient(135deg, #66c300, #00b34f);
  color: #fff;
  padding: 1.1rem 1rem 1.35rem;
  text-align: center;
}

.swish-panel-top h3 {
  margin: 0 0 0.7rem;
  font-size: clamp(1.2rem, 2.2vw, 1.8rem);
}

.qr-code {
  min-height: 210px;
  display: grid;
  place-content: center;
}

.qr-code img {
  width: min(58vw, 200px);
  height: auto;
  border-radius: 8px;
  border: 8px solid #f3f3f3;
  background: #fff;
}

#qr-hint {
  margin: 0.7rem 0 0;
  min-height: 1.1rem;
  color: #eef9f0;
}

#qr-details {
  margin: 0.35rem 0 0;
  min-height: 2.3rem;
  color: #f4fff6;
  font-size: 1.15rem;
  line-height: 1.45;
  white-space: pre-line;
}

.swish-panel-bottom {
  background: #f4f4f4;
  padding: 0.85rem;
  display: grid;
  place-content: center;
}

.swish-logo-image {
  display: block;
  height: 34px;
  width: auto;
}

.stats-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.35rem;
}

.stats-header-row h2 {
  margin: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(90px, 1fr));
  gap: 0.75rem;
  margin: 0.55rem 0 0.75rem;
}

.stats-quick-range {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.25rem 0 0.55rem;
}

.stats-quick-range button {
  min-height: 38px;
  padding: 0.45rem 0.65rem;
  font-size: 0.95rem;
}

.stats-quick-range button.active-range {
  background: var(--accent);
  color: #fff;
}

.mobile-sticky-total {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 0.6rem);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: #ffffff;
  border: 2px solid #c7d3de;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  padding: 0.6rem 0.8rem;
}

.mobile-sticky-total strong,
.mobile-sticky-total span {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
}

.stats-grid-top {
  margin-top: 0.45rem;
}

.stats-grid article {
  border: 1px solid #cde3d6;
  border-radius: 8px;
  padding: 0.35rem 0.55rem 0.45rem;
  background: linear-gradient(180deg, #f1faf4 0%, #e8f5ed 100%);
}

.stats-grid article h3 {
  margin: 0 0 0.25rem;
  font-size: 1.08rem;
  font-weight: 640;
}

.big {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.items-cell {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.transactions-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.transactions-table {
  width: 100%;
  table-layout: fixed;
}

.transactions-table th:nth-child(1),
.transactions-table td:nth-child(1) {
  width: clamp(96px, 12vw, 160px);
}

.transactions-table th:nth-child(3),
.transactions-table td:nth-child(3) {
  width: 72px;
  white-space: normal;
}

.transactions-table th:nth-child(4),
.transactions-table td:nth-child(4) {
  width: 56px;
  padding-left: 0;
  padding-right: 0;
}

.transactions-table td {
  overflow-wrap: anywhere;
}

.transactions-table td:nth-child(4) .icon-x {
  margin-left: auto;
}

.stats-category-row td {
  background: #f3f7fb;
  font-weight: 700;
}

.about-layout {
  display: grid;
  gap: 0.7rem;
}

.about-main,
.about-side {
  display: grid;
  gap: 0.7rem;
}

.about-layout {
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  align-items: start;
}

.about-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem 0.85rem 0.8rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.about-intro {
  background:
    linear-gradient(180deg, #f2faf5 0%, #ffffff 100%);
  border-color: #cfe4d7;
}

.about-license {
  border-color: #bfd7ea;
  background:
    linear-gradient(180deg, #edf6fd 0%, #ffffff 100%);
}

.about-card h2,
.about-card h3 {
  margin: 0 0 0.35rem;
}

.about-card p {
  margin: 0 0 0.35rem;
  line-height: 1.38;
}

.about-card p:last-child {
  margin-bottom: 0;
}

.about-card ul,
.about-card ol {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.2rem;
  line-height: 1.36;
}

.about-side {
  position: sticky;
  top: 0.6rem;
}

.about-card a {
  color: #0a5b92;
  font-weight: 600;
}

.about-card a:hover {
  color: #084872;
}

.icon-x {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--danger);
  border: 1px solid #e5b1ac;
  line-height: 1;
  font-size: 1.2rem;
  font-weight: 700;
}

.icon-x:hover {
  background: #fdeceb;
  color: #8b1d14;
}

.hidden {
  display: none !important;
}

.danger {
  background: var(--danger);
}

.save-sale-btn {
  background: #2456d3;
}

.save-sale-btn:hover {
  background: #1c45ac;
}

.save-sale-btn.saved {
  background: #1a8f58;
}

.site-footer {
  margin-top: auto;
  padding: 0 1rem 0.35rem;
  text-align: center;
  color: #425261;
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .sales-layout {
    grid-template-columns: 1fr;
  }

  .sales-left {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .sales-middle {
    border-left: 0;
    padding-left: 0;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .tab-panel[data-panel="sales"] {
    padding-bottom: 2.5rem;
  }

  .mobile-sticky-total {
    position: sticky;
    left: auto;
    right: auto;
    bottom: 0;
    margin-top: 0.65rem;
  }
}

@media (max-width: 900px) {
  .site-header {
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
  }

  .header-brand {
    width: 100%;
  }

  .tabs {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 0.2rem;
  }

  .tab {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.52rem 0.5rem;
    font-size: 0.99rem;
    justify-content: center;
  }

  .tab span {
    white-space: nowrap;
  }

  .tab-icon {
    width: 0.95rem;
    height: 0.95rem;
  }

  .custom-amount-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .about-layout {
    grid-template-columns: 1fr;
  }

  .about-side {
    position: static;
    top: auto;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .site-header {
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
  }

  .header-brand {
    width: 100%;
  }

  .tabs {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .tab {
    flex: 1 1 calc(50% - 0.3rem);
    min-width: 140px;
    padding: 0.6rem 0.85rem;
    font-size: 1rem;
  }

  .tab-icon {
    width: 1.05rem;
    height: 1.05rem;
  }

  .total-row {
    grid-template-columns: 1fr 42px 88px 40px;
  }

  .list li {
    align-items: flex-start;
  }

  .product-actions {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.25rem;
  }

  .product-actions button {
    width: 100%;
    min-height: 32px;
    padding: 0.3rem 0.3rem;
    font-size: 0.82rem;
  }

}
