@font-face {
  font-family: 'Sun-Seed';
  src: url('font/Sun-Seed.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sun-Seed';
  src: url('font/Sun-Seed%20Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sun-Seed';
  src: url('font/Sun-Seed%20Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg-cream: #f5f3ec;
  --bg-leaf: #e8f0ea;
  --bg-moss: #d3e2da;
  --green-900: #005c4d;
  --green-700: #0d7362;
  --green-500: #1f8a74;
  --green-200: #d6ebe4;
  --gold-600: #ddb845;
  --gold-500: #ecc850;
  --gold-200: #f7efcf;
  --text-main: #143d35;
  --text-soft: #456c63;
  --danger: #9f3a32;
  --white: #ffffff;
  --radius-xl: 18px;
  --radius-md: 12px;
  --shadow: 0 10px 30px rgba(0, 92, 77, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Sun-Seed', 'Segoe UI', 'Trebuchet MS', sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 20% 5%, #ffffff 0%, var(--bg-cream) 45%, var(--bg-leaf) 100%);
  min-height: 100%;
}

.texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(0, 92, 77, 0.08) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.45;
  z-index: 0;
}

.app-header,
.app-shell {
  position: relative;
  z-index: 1;
}

.app-header {
  margin: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #005c4d, #0a6d5e 55%, #0a5c50);
  color: var(--white);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow);
}

.app-header h1 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: 0.5px;
}

.subtitle {
  margin: 0.2rem 0 0;
  opacity: 0.95;
  font-size: 0.95rem;
}

.badge {
  margin: 0;
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(236, 200, 80, 0.2);
  color: var(--gold-200);
  font-size: 0.75rem;
  letter-spacing: 0.3px;
}

.brand-icon {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.24));
}

.brand-icon-badge {
  width: 88px;
  height: 88px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(236, 200, 80, 0.18);
  border: 1px solid rgba(236, 200, 80, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.app-shell {
  margin: 0 1rem 1.5rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.tab {
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  background: #dcebe5;
  color: var(--green-900);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tab.active {
  background: var(--green-900);
  color: var(--white);
}

.panel {
  display: none;
  gap: 1rem;
}

.panel.active {
  display: grid;
}

.section-head p {
  margin-top: 0.2rem;
  color: var(--text-soft);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.stat-card {
  background: linear-gradient(150deg, #fffdf4, #f4ebc8);
  border: 1px solid #e4d9ab;
  border-radius: var(--radius-md);
  padding: 1rem;
}

.stat-card h3 {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-soft);
}

.stat-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.8rem;
  color: var(--gold-600);
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d5e7de;
  border-radius: var(--radius-md);
  padding: 0.95rem;
  box-shadow: 0 6px 18px rgba(0, 92, 77, 0.09);
}

.form-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--green-900);
}

input,
select,
textarea,
button {
  font-family: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #bdd8ce;
  border-radius: 10px;
  padding: 0.62rem 0.7rem;
  background: #fcfffe;
  color: var(--text-main);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(13, 115, 98, 0.25);
  border-color: var(--green-500);
}

.check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.check input {
  width: auto;
}

.image-preview-wrap {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

#plant-image-preview {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  border: 1px solid #bcd8ce;
  background: #f6faf8;
  object-fit: cover;
  padding: 0.4rem;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.62rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(120deg, var(--green-900), var(--green-700));
  color: var(--white);
}

.btn-soft {
  background: #e3efe9;
  color: var(--green-900);
}

.btn-danger {
  background: #f5dfdc;
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.table-wrap h3 {
  margin-top: 0;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  text-align: left;
  padding: 0.55rem;
  border-bottom: 1px solid #deebe5;
  vertical-align: top;
}

th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: var(--text-soft);
}

.table-plant-image {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid #c6ddd4;
  object-fit: cover;
  background: #f8fbf9;
  padding: 0.2rem;
}

@media (max-width: 759px) {
  .table-scroll {
    overflow: visible;
  }

  .table-scroll table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .table-scroll thead {
    border: 0;
    clip-path: inset(50%);
    height: 1px;
    margin: 0;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
  }

  .table-scroll tbody {
    display: grid;
    gap: 0.75rem;
  }

  .table-scroll tbody tr {
    display: block;
    border: 1px solid #cfe1d9;
    border-radius: 12px;
    padding: 0.75rem;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 92, 77, 0.06);
  }

  .table-scroll tbody tr.row-empty {
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
  }

  .table-scroll tbody tr.row-empty td {
    display: block;
    border: 1px dashed #b6d4c8;
    border-radius: 10px;
    padding: 0.8rem;
    text-align: center;
    color: var(--text-soft);
    background: #f8fcfa;
  }

  .table-scroll tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px dashed #deebe5;
    text-align: right;
    word-break: break-word;
  }

  .table-scroll tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-soft);
    text-align: left;
    flex: 0 0 42%;
    max-width: 42%;
  }

  .table-scroll tbody tr.row-empty td::before {
    content: '';
    display: none;
  }

  .table-scroll tbody td:last-child {
    border-bottom: none;
    padding-bottom: 0.1rem;
  }

  .table-scroll tbody td.cell-image {
    justify-content: flex-start;
    align-items: center;
  }

  .table-scroll tbody td.cell-image::before {
    flex: 0 0 auto;
    max-width: none;
    margin-right: 0.8rem;
  }

  .table-scroll tbody td.cell-actions {
    display: block;
    text-align: left;
  }

  .table-scroll tbody td.cell-actions::before {
    display: block;
    margin-bottom: 0.5rem;
  }

  .table-scroll tbody td.cell-actions .actions {
    width: 100%;
  }

  .table-scroll tbody td.cell-actions .btn,
  .table-scroll tbody td.cell-actions button.btn {
    width: 100%;
  }
}

.line-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.line-header h3 {
  margin: 0;
}

.sale-items {
  display: grid;
  gap: 0.65rem;
}

.sales-top-actions {
  display: flex;
  justify-content: flex-start;
}

.customer-fields {
  border: 1px dashed #b6d4c8;
  border-radius: 12px;
  padding: 0.75rem;
  background: #f8fcfa;
}

.sale-code-entry {
  border: 1px dashed #b6d4c8;
  border-radius: 12px;
  padding: 0.7rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  background: #f8fcfa;
}

.sale-code-entry button {
  width: 100%;
}

body.scanner-open {
  overflow: hidden;
}

.scanner-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(11, 48, 41, 0.7);
  display: grid;
  place-items: center;
  padding: 0.9rem;
}

.scanner-dialog {
  width: min(100%, 540px);
  background: #f8fcfa;
  border: 1px solid #c9ddd5;
  border-radius: 16px;
  padding: 0.85rem;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.25);
}

.scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
}

.scanner-header h3 {
  margin: 0;
  color: var(--green-900);
  font-size: 1.05rem;
}

.scanner-status,
.scanner-hint {
  margin: 0.35rem 0 0.65rem;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.scanner-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #0b211d;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-guide {
  position: absolute;
  inset: 10% 14%;
  border: 2px dashed rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  pointer-events: none;
}

.scanner-fallback-host {
  position: absolute;
  inset: 0;
  background: #0b211d;
}

.scanner-fallback-reader {
  width: 100%;
  height: 100%;
}

.scanner-fallback-reader video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.3rem;
}

.sale-cart-empty {
  margin: 0;
  border: 1px dashed #b6d4c8;
  border-radius: 10px;
  padding: 0.8rem;
  color: var(--text-soft);
  background: #f8fcfa;
}

.sale-cart-row {
  border: 1px dashed #b6d4c8;
  border-radius: 12px;
  padding: 0.7rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  background: #ffffff;
}

.sale-cart-main strong {
  display: block;
}

.sale-cart-main span {
  color: var(--text-soft);
  font-size: 0.86rem;
}

.sale-cart-qty,
.sale-cart-subtotal {
  color: var(--green-900);
  font-weight: 700;
}

.sale-cart-total {
  border-top: 1px solid #deebe5;
  margin-top: 0.2rem;
  padding: 0.8rem 0.25rem 0.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

#care-links {
  padding-left: 1rem;
  margin: 0.5rem 0 0;
}

#care-links a {
  color: var(--green-900);
  word-break: break-all;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  background: #005c4d;
  color: white;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  font-size: 0.9rem;
  z-index: 10;
  box-shadow: var(--shadow);
}

.care-page {
  background: radial-gradient(circle at 20% 5%, #ffffff 0%, #f5f3ec 45%, #e8f0ea 100%);
}

.care-shell {
  max-width: 920px;
  margin: 1.2rem auto;
  padding: 0 1rem 1.5rem;
}

.care-plant-image {
  display: flex;
  justify-content: center;
}

#care-image {
  width: min(360px, 100%);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid #c6ddd4;
  background: #f9fcfb;
  padding: 0.6rem;
}

.care-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}

.care-item {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #cce0d7;
  border-radius: 12px;
  padding: 0.8rem;
}

.care-item h3 {
  margin: 0;
  color: var(--green-900);
  font-size: 0.88rem;
}

.care-item p {
  margin: 0.35rem 0 0;
  color: #254740;
}

.care-notes h3 {
  margin-top: 0;
}

.care-footer {
  color: var(--text-soft);
  font-size: 0.86rem;
}

@media (min-width: 760px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .full {
    grid-column: 1 / -1;
  }

  .sale-code-entry {
    grid-template-columns: minmax(0, 1.4fr) 120px auto auto;
    align-items: end;
  }

  .sale-code-entry button {
    width: auto;
  }

  .sale-cart-row {
    grid-template-columns: minmax(0, 1.4fr) 74px 130px auto;
    align-items: end;
  }

  .care-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .app-header,
  .app-shell {
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
  }

  .app-header {
    margin-top: 1.2rem;
  }
}

