/* --- CSS Custom Properties --- */
:root {
  --color-bg: #F8F6F2;
  --color-surface: #FDFCFA;
  --color-border: #E8DFD3;
  --color-border-hover: #B3A497;
  --color-text: #3A3530;
  --color-text-secondary: #B3A497;
  --color-accent: #283449;
  --color-accent-hover: #1a2233;
  --color-accent-light: #F0EDE8;
  --color-gold: #C8A96A;
  --color-gold-light: #F7F2E8;
  --color-sage: #A4AE98;
  --color-sage-light: #EEF0EB;
  --color-error: #B8453A;
  --color-error-bg: #FCF5F4;
  --color-success: #5A8A6A;
  --color-success-bg: #F2F7F3;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(40,52,73,0.04), 0 1px 2px rgba(40,52,73,0.03);
  --shadow-lg: 0 4px 12px rgba(40,52,73,0.05), 0 2px 4px rgba(40,52,73,0.03);
  --max-width: 720px;
  --paper-texture: url("data:image/svg+xml,%3Csvg width='300' height='300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  font-size: 17px;
  background-color: var(--color-bg);
  background-image: var(--paper-texture);
  color: var(--color-text);
  line-height: 1.7;
  min-height: 100vh;
  position: relative;
}

/* Headings */
h1, h2, h3, h4, .section-top h2, .passcode-box h2 {
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-weight: 600;
  letter-spacing: 0.02em;
}

h3 { font-size: 1.4rem; }

/* Subtle gold star scatter */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1px 1px at 10% 15%, #C8A96A 60%, transparent),
    radial-gradient(1px 1px at 85% 8%, #C8A96A 60%, transparent),
    radial-gradient(1.5px 1.5px at 25% 35%, #C8A96A 50%, transparent),
    radial-gradient(1px 1px at 72% 28%, #C8A96A 50%, transparent),
    radial-gradient(1px 1px at 15% 55%, #C8A96A 40%, transparent),
    radial-gradient(2px 2px at 90% 50%, #C8A96A 35%, transparent),
    radial-gradient(1.5px 1.5px at 60% 70%, #C8A96A 50%, transparent),
    radial-gradient(1px 1px at 35% 78%, #C8A96A 40%, transparent),
    radial-gradient(1.5px 1.5px at 78% 88%, #C8A96A 45%, transparent),
    radial-gradient(1px 1px at 5% 90%, #C8A96A 35%, transparent),
    radial-gradient(1.5px 1.5px at 50% 12%, #C8A96A 40%, transparent),
    radial-gradient(1px 1px at 45% 45%, #C8A96A 35%, transparent),
    radial-gradient(2px 2px at 92% 20%, #C8A96A 40%, transparent),
    radial-gradient(1px 1px at 8% 42%, #C8A96A 35%, transparent);
  background-size: 100% 100%;
  opacity: 0.55;
}

/* Constellation corner - top right */
body::after {
  content: '';
  position: fixed; top: 0; right: 0; width: 200px; height: 200px; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(2px 2px at 150px 25px, #C8A96A 55%, transparent),
    radial-gradient(1.5px 1.5px at 100px 55px, #C8A96A 55%, transparent),
    radial-gradient(2px 2px at 55px 30px, #C8A96A 55%, transparent),
    radial-gradient(1.5px 1.5px at 170px 85px, #C8A96A 45%, transparent),
    radial-gradient(1.5px 1.5px at 120px 115px, #C8A96A 45%, transparent),
    radial-gradient(1px 1px at 45px 80px, #C8A96A 40%, transparent),
    radial-gradient(1px 1px at 130px 50px, #C8A96A 35%, transparent),
    radial-gradient(1.5px 1.5px at 90px 100px, #C8A96A 40%, transparent);
  background-size: 200px 200px;
  opacity: 0.45;
}

/* Botanical accent - bottom left corner */
.container::before {
  content: '';
  position: fixed; bottom: 0; left: 0; width: 120px; height: 160px; pointer-events: none; z-index: 0;
  background:
    radial-gradient(1px 1px at 30px 130px, #A6AF9C 50%, transparent),
    radial-gradient(1.5px 1.5px at 60px 100px, #A6AF9C 40%, transparent),
    radial-gradient(1px 1px at 90px 140px, #A6AF9C 35%, transparent),
    radial-gradient(1.5px 1.5px at 20px 80px, #A6AF9C 35%, transparent),
    radial-gradient(1px 1px at 80px 60px, #A6AF9C 30%, transparent);
  opacity: 0.35;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  position: relative;
  z-index: 1;
}

/* --- Header --- */
header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 50%;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 16px rgba(40,52,73,0.06);
}

@media (min-width: 641px) {
  .logo { width: 130px; height: 130px; }
}

/* Crescent moon before section titles */
.section-top h2::before {
  content: '☾ ';
  color: var(--color-gold);
  font-size: 1.1em;
}

.subtitle {
  color: var(--color-text-secondary);
  font-size: 1.1rem;
  font-weight: 400;
}

/* --- Drop Zone --- */
.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
  background: var(--color-surface);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--color-gold);
  background: var(--color-gold-light);
}

.drop-zone.has-error {
  border-color: var(--color-error);
  background: var(--color-error-bg);
}

.upload-icon {
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
}

.drop-zone:hover .upload-icon,
.drop-zone.drag-over .upload-icon {
  color: var(--color-gold);
}

.drop-text {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.drop-hint {
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}

/* --- Preview --- */
.preview {
  margin-top: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.preview img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.preview-info {
  flex: 1;
  min-width: 0;
}

.preview-info span {
  display: block;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-info span:first-child {
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

/* --- Product Type --- */
.product-type {
  margin-top: 1.25rem;
}

.product-type label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 0.4rem;
}

.product-type input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--color-text);
  background: var(--color-surface);
}

.product-type input::placeholder {
  color: #b0a89a;
}

.product-type input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(74,103,65,0.12);
}

/* --- Generate Button --- */
.btn-generate {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.85rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-sage);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-generate:hover:not(:disabled) {
  background: #8F9A84;
}

.btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Button Icon (remove/dismiss) --- */
.btn-icon {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  border-radius: var(--radius);
  transition: color 0.15s, background-color 0.15s;
}

.btn-icon:hover {
  color: var(--color-text);
  background: rgba(0,0,0,0.05);
}

/* --- Loading --- */
.loading {
  margin-top: 2rem;
  text-align: center;
  padding: 2rem;
}

.loading-spinner {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.loading-text {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

/* --- Spinner dots (shared) --- */
.spinner-dot {
  width: 10px;
  height: 10px;
  background: var(--color-sage);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.spinner-dot:nth-child(1) { animation-delay: -0.32s; }
.spinner-dot:nth-child(2) { animation-delay: -0.16s; }
.spinner-dot:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* --- Error Banner --- */
.error-banner {
  margin-top: 1.5rem;
  padding: 0.85rem 1rem;
  background: var(--color-error-bg);
  border: 1px solid var(--color-error);
  border-radius: var(--radius);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: var(--color-error);
  font-size: 0.9rem;
}

.error-banner .btn-icon {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--color-error);
}

/* --- Results --- */
.results {
  margin-top: 2rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* --- Results top bar --- */
.results-top {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.btn-back {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-back:hover {
  color: var(--color-text);
  border-color: var(--color-text-secondary);
}

/* --- Before / After Image Compare --- */
.image-compare {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.compare-item {
  text-align: center;
  flex: 1;
  max-width: 220px;
}

.compare-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  color: var(--color-text-secondary);
}

.compare-label::after {
  content: '';
}

.compare-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
}

.compare-arrow {
  font-size: 1.5rem;
  color: var(--color-gold);
  flex-shrink: 0;
  padding: 0 0.25rem;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  -webkit-overflow-scrolling: touch;
}

.tab {
  flex-shrink: 0;
  padding: 0.8rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.tab:hover {
  color: var(--color-text);
}

.tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

/* --- Tab Panels --- */
.tab-panels {
  padding: 1.5rem;
}

.tab-panel {
  display: none;
}

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

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.panel-header h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 600;
}

.panel-content {
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* --- Copy Button --- */
.btn-copy {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-accent-light);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-copy:hover {
  background: var(--color-sage);
  color: #fff;
}

.btn-copy.copied {
  background: var(--color-success-bg);
  border-color: var(--color-success);
  color: var(--color-success);
}

.btn-copy-small {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
}

/* --- SEO Section --- */
.seo-section {
  padding: 1.5rem;
}

.seo-field {
  margin-bottom: 1.5rem;
  position: relative;
}

.seo-field:last-child {
  margin-bottom: 0;
}

.seo-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.seo-value {
  font-size: 0.95rem;
  line-height: 1.7;
  padding: 0.75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  white-space: pre-wrap;
  margin-bottom: 0.5rem;
}

.seo-blog {
  max-height: 300px;
  overflow-y: auto;
}

/* --- Footer --- */
footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

footer p {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
}

footer .disclaimer {
  max-width: 540px;
  margin: 0.65rem auto 0;
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  opacity: 0.7;
  line-height: 1.5;
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

/* --- Main Navigation --- */
.burger-menu { position: relative; margin-top: 1rem; }
.burger-btn {
  display: none; width: 100%; padding: 0.55rem 1rem;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); font-size: 1.1rem; cursor: pointer; text-align: left; color: var(--color-text);
}
.main-nav {
  display: flex;
  gap: 0.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }

@media (max-width: 768px) {
  .burger-btn { display: block; }
  .main-nav {
    display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0;
    z-index: 90; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 0.5rem;
  }
  .main-nav.open { display: flex; }
}

.nav-tab {
  flex-shrink: 0;
  padding: 0.4rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0.02em;
}

.nav-tab:hover { color: var(--color-gold); }
.nav-tab.active {
  background: var(--color-sage);
  color: #fff;
}

/* --- Section visibility --- */
.app-section { display: block; }
.app-section.hidden { display: none !important; }

.section-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.section-top h2 {
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0;
}

.section-top-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.order-link-hint {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}
.order-link-hint a {
  color: var(--color-accent);
  font-weight: 500;
}

/* --- Buttons --- */
.btn-primary {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--color-sage);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}
.btn-primary:hover { background: #8F9A84; }
.btn-cancel {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
}
.btn-cancel:hover { background: var(--color-border); }

/* --- Inventory Grid --- */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.inventory-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.inventory-card:hover { box-shadow: var(--shadow-lg); }

.inventory-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--color-bg);
}

.inventory-card-body {
  padding: 0.75rem;
}

.inventory-card-body h4 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.inventory-card-body .item-price {
  font-weight: 600;
  color: var(--color-accent);
  font-size: 0.95rem;
}

.inventory-card-body .item-meta {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
}

.inventory-card-actions {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  background: var(--color-surface);
  color: var(--color-text-secondary);
}
.btn-sm:hover { background: var(--color-bg); color: var(--color-text); }
.btn-sm.danger { color: var(--color-error); border-color: transparent; }
.btn-sm.danger:hover { background: var(--color-error-bg); }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

/* --- Modal --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal.hidden { display: none; }

.modal-content {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-lg { max-width: 640px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
}
.modal-header h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; font-weight: 600; }

.modal-content form {
  padding: 1.5rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

/* --- Forms --- */
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 0.35rem;
  letter-spacing: 0.02em;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--color-surface);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(74,103,65,0.1);
}

.form-row {
  display: flex;
  gap: 0.75rem;
}
.form-row .form-group { flex: 1; }

.form-photo-preview {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-top: 0.5rem;
  border: 1px solid var(--color-border);
}

/* --- Orders List --- */
.orders-list { display: flex; flex-direction: column; gap: 0.75rem; }

.order-card-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: background 0.1s;
}
.order-card-header:hover { background: var(--color-bg); }

.order-card-header .order-info h4 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 600;
}
.order-card-header .order-info span {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.order-card-body {
  padding: 0 1rem 1rem;
  display: none;
}
.order-card-item.expanded .order-card-body { display: block; }

.order-items-table { width: 100%; border-collapse: collapse; margin-bottom: 0.75rem; }
.order-items-table th, .order-items-table td {
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.order-items-table th { color: var(--color-text-secondary); font-weight: 600; }

.order-totals {
  text-align: right;
  font-size: 0.85rem;
}
.order-totals .total { font-weight: 700; font-size: 1rem; margin-top: 0.25rem; }

.order-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* --- Status Badges --- */
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-badge.order_placed { background: #fff7e0; color: #b45309; }
.status-badge.paid { background: #e0f2fe; color: #0369a1; }
.status-badge.shipped { background: #dcfce7; color: #15803d; }
.status-badge.completed { background: #ede9fe; color: #6b21a8; }

/* --- Invoice Items --- */
.invoice-items { display: flex; flex-direction: column; gap: 0.5rem; }

.invoice-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.invoice-line select { flex: 2; }
.invoice-line input { flex: 1; }
.invoice-line .btn-icon { font-size: 1.2rem; }

.btn-add-line {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  color: var(--color-accent);
  background: none;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  margin-top: 0.5rem;
}
.btn-add-line:hover { border-color: var(--color-accent); background: var(--color-accent-light); }

.invoice-total {
  text-align: right;
  padding: 0.75rem 0;
  font-size: 1.1rem;
  border-top: 2px solid var(--color-accent);
  margin-top: 0.5rem;
}
.invoice-total strong { color: var(--color-accent); }

/* --- Customer Order Form --- */
.order-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.order-card h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.customer-items { display: flex; flex-direction: column; gap: 0.75rem; }

.customer-item-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  align-items: center;
}
.customer-item-card img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--color-bg);
}
.customer-item-card .item-info { flex: 1; }
.customer-item-card .item-info h4 { font-family: 'Cormorant Garamond', serif; font-size: 1.25rem; font-weight: 600; }
.customer-item-card .item-info .item-price { font-weight: 600; color: var(--color-accent); font-size: 0.85rem; }
.customer-item-card .item-qty {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.customer-item-card .item-qty input {
  width: 50px;
  padding: 0.3rem;
  text-align: center;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 0.85rem;
}

.order-summary { margin-bottom: 0.75rem; }

.order-total-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}
.order-total-row.total {
  border-top: 2px solid var(--color-accent);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
  font-size: 1.1rem;
  color: var(--color-text);
}

.order-confirmation {
  text-align: center;
  padding: 3rem 1rem;
}
.confirm-icon {
  width: 64px; height: 64px;
  line-height: 64px;
  background: var(--color-success-bg);
  color: var(--color-success);
  border-radius: 50%;
  font-size: 2rem;
  margin: 0 auto 1rem;
}
.order-confirmation h2 { margin-bottom: 0.5rem; }
.order-confirmation p { color: var(--color-text-secondary); margin-bottom: 0.25rem; }
.confirm-ref { font-size: 0.9rem; margin-top: 1rem; }

/* --- Inventory Toolbar --- */
.inv-toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.inv-search {
  flex: 1;
  min-width: 180px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  background: var(--color-surface);
}
.inv-search:focus { outline: none; border-color: var(--color-accent); }

.inv-filters { display: flex; gap: 0.25rem; }

.inv-filter {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.inv-filter:hover { border-color: var(--color-accent); color: var(--color-accent); }
.inv-filter.active { background: var(--color-sage); color: #fff; border-color: var(--color-accent); }

/* --- Data Table --- */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.data-table tbody tr:hover { background: var(--color-bg); }

/* --- Inventory card updates --- */
.inv-stats {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
  font-size: 0.7rem;
  color: var(--color-text-secondary);
}
.inv-stats span { white-space: nowrap; }
.inv-stat-label { color: var(--color-text-secondary); }
.inv-stat-avail { color: var(--color-success); font-weight: 600; }
.inv-stat-reserved { color: #b45309; font-weight: 600; }
.inv-stat-sold { color: var(--color-text-secondary); font-weight: 600; }

/* --- Inventory supply lines --- */
.inv-supply-lines { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; }
.inv-supply-row {
  display: flex; gap: 0.4rem; align-items: center;
}
.inv-supply-row select { flex: 2; padding: 0.4rem 0.5rem; font-size: 0.8rem; border: 1px solid var(--color-border); border-radius: var(--radius); }
.inv-supply-row input { flex: 0.5; width: 50px; }

/* --- Supplies table --- */
.supply-btn-row { display: flex; gap: 0.25rem; }

/* --- Dashboard --- */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.dash-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 0.6rem;
  text-align: center;
  min-width: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(179,164,151,0.08);
}
.dash-card span {
  display: block;
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}
.dash-card strong { font-size: 1.1rem; white-space: nowrap; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.dash-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}
.dash-section h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.4rem; font-weight: 600; margin-bottom: 0.75rem; }

.dash-status { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.dash-status-item {
  flex: 1; min-width: 80px; text-align: center; padding: 0.5rem;
  border-radius: var(--radius); background: var(--color-bg);
}
.dash-status-item .count { font-size: 1.5rem; font-weight: 700; }
.dash-status-item .label { font-size: 0.7rem; color: var(--color-text-secondary); text-transform: uppercase; }

@media (max-width: 640px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dashboard-cards { grid-template-columns: 1fr 1fr; }
  .dash-card span { font-size: 0.6rem; }
  .dash-card strong { font-size: 0.95rem; }
}
.calc-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.calc-costs { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; }

.calc-cost-row {
  display: flex; gap: 0.4rem; align-items: center;
}
.calc-cost-row input { width: 100%; }
.calc-cost-row .cost-name { flex: 2; }
.calc-cost-row .cost-amount { flex: 1; }
.calc-cost-row .cost-qty { flex: 0.5; }

.calc-summary { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--color-border); }
.calc-row {
  display: flex; justify-content: space-between; padding: 0.25rem 0;
  font-size: 0.85rem; color: var(--color-text-secondary);
}
.calc-row.subtotal {
  border-top: 1px solid var(--color-border); padding-top: 0.5rem; margin-top: 0.25rem;
  font-weight: 600; color: var(--color-text); font-size: 0.9rem;
}

.profit-toggle { display: flex; gap: 0.25rem; }
.profit-btn {
  padding: 0.35rem 0.75rem; font-size: 0.8rem; font-weight: 500;
  border: 1px solid var(--color-border); border-radius: 16px;
  background: var(--color-surface); color: var(--color-text-secondary); cursor: pointer;
}
.profit-btn.active { background: var(--color-sage); color: #fff; border-color: var(--color-accent); }

.calc-final {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 0 0; margin-top: 0.75rem; border-top: 1px solid var(--color-gold);
  font-size: 1.15rem;
}
.calc-final strong { color: var(--color-text); font-size: 1.4rem; }

/* --- Passcode --- */
.passcode-overlay {
  position: fixed; inset: 0; background: var(--color-bg);
  display: flex; align-items: center; justify-content: center; z-index: 999;
}
.passcode-overlay.hidden { display: none; }
.passcode-box {
  text-align: center; padding: 2.5rem;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  max-width: 360px; width: 100%;
}
.passcode-logo { width: 280px; height: 280px; border-radius: 50%; object-fit: contain; margin-bottom: 1.5rem; box-shadow: 0 2px 20px rgba(40,52,73,0.08); }
.passcode-box h2 { font-size: 2.5rem; color: var(--color-accent); margin-bottom: 0.25rem; letter-spacing: 0.06em; }
.passcode-box p { color: var(--color-text-secondary); font-size: 0.95rem; margin-bottom: 1.5rem; }
.passcode-box input {
  width: 100%; padding: 0.65rem; text-align: center; font-size: 1.5rem; letter-spacing: 0.5em;
  border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: 0.75rem;
}
.passcode-box input:focus { outline: none; border-color: var(--color-accent); }
.passcode-box button {
  width: 100%; padding: 0.65rem; font-size: 0.95rem; font-weight: 600;
  color: #fff; background: var(--color-sage); border: none; border-radius: var(--radius); cursor: pointer;
}
.passcode-error { color: var(--color-error); font-size: 0.8rem; margin-top: 0.5rem; }

/* --- Bulk Add Items --- */
#bulkTableBody td { padding: 0.3rem 0.25rem; vertical-align: middle; }
#bulkTableBody input, #bulkTableBody select {
  padding: 0.3rem; border: 1px solid var(--color-border); border-radius: 3px; font-size: 0.75rem;
}
#bulkTableBody input:focus, #bulkTableBody select:focus { outline: none; border-color: var(--color-sage); }

/* --- Distributor --- */
.dist-filter-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.dist-period { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.radio-label { font-size: 0.8rem; color: var(--color-text-secondary); cursor: pointer; display: flex; align-items: center; gap: 0.25rem; }
.radio-label input { accent-color: var(--color-accent); }
.dist-custom { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.dist-custom input { padding: 0.3rem 0.5rem; border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 0.8rem; }

/* --- Mobile --- */
@media (max-width: 640px) {
  .container {
    padding: 1.25rem 1rem 2.5rem;
  }
  .section-top h2 { font-size: 1.7rem; }

  header h1 {
    font-size: 1.4rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .drop-zone {
    padding: 2rem 1rem;
  }

  .tab {
    padding: 0.65rem 0.85rem;
    font-size: 0.8rem;
  }

  .tab-panels {
    padding: 1rem;
  }

  .seo-section {
    padding: 1rem;
  }

  .image-compare {
    padding: 1rem;
    gap: 0.5rem;
  }

  .compare-arrow {
    font-size: 1.25rem;
    padding: 0;
  }
}
