* {
  box-sizing: border-box;
}

:root {
  --kw-black: #171311;
  --kw-black-soft: #241d19;
  --kw-brown-dark: #3b2a1f;
  --kw-brown: #5a3e2b;
  --kw-brown-mid: #7a5a43;
  --kw-brown-light: #b08a6a;
  --kw-cream: #f7f3ee;
  --kw-cream-soft: #e9dfd3;
  --kw-border: #c7b29f;
  --kw-danger: #9b3526;
  --kw-danger-hover: #812b1f;
  --kw-success: #6f4d33;
  --kw-success-hover: #5d402b;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--kw-cream);
  color: var(--kw-black);
}

.hero {
  background: linear-gradient(180deg, #2a1f18 0%, #171311 100%);
  color: var(--kw-cream);
  border-bottom: 1px solid #4b382c;
  padding: 56px 24px;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--kw-cream-soft);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.status-panel {
  min-width: 250px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 18px;
}

.status-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.status-line + .status-line {
  margin-top: 12px;
}

.status-label {
  color: var(--kw-cream-soft);
  font-weight: 700;
}

.status-value {
  color: #fff;
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.pill.neutral {
  background: rgba(255, 255, 255, 0.12);
  color: var(--kw-cream);
}

.pill.success {
  background: rgba(84, 153, 102, 0.22);
  color: #d9f7df;
}

.pill.error {
  background: rgba(155, 53, 38, 0.25);
  color: #ffd9d2;
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.05;
  margin: 0 0 18px;
  color: #ffffff;
}

h2 {
  font-size: 1.6rem;
  margin: 0 0 10px;
  color: var(--kw-black);
}

h3 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--kw-black);
}

p {
  margin: 0;
  color: var(--kw-cream-soft);
  font-size: 1.05rem;
  line-height: 1.5;
  max-width: 900px;
}

.section-copy {
  color: var(--kw-brown);
  font-size: 0.98rem;
  font-weight: 600;
}

.section-head {
  margin-top: 42px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.button-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.search-section {
  margin-bottom: 20px;
}

.search-controls {
  display: grid;
  grid-template-columns: 220px minmax(280px, 1fr);
  gap: 14px;
  align-items: end;
}

.search-mode label,
.search-box label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--kw-brown-dark);
}

.message {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #d9c6b3;
  background: #fffdfb;
  color: var(--kw-brown-dark);
  font-weight: 700;
}

.message.success {
  background: #eef7ef;
  border-color: #b8d2bc;
  color: #2f5b38;
  border-left: 4px solid #23c55e;
}

.message.error {
  background: #fff1ee;
  border-color: #e2beb5;
  color: #7a2316;
  border-left: 4px solid #ef4444;
}

.message.neutral {
  border-left: 4px solid #64748b;
}

.item-card-section {
  margin: 26px 0 28px;
}

.hidden {
  display: none !important;
}

.item-card {
  background: #fffdfb;
  border: 1px solid #cfbead;
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(35, 22, 15, 0.08);
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 22px;
  padding: 22px;
}

.item-card-image {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.image-frame {
  width: 100%;
}

.detail-image {
  width: 100%;
  min-height: 260px;
  max-height: 360px;
  object-fit: cover;
  border: 1px solid #cfbead;
  border-radius: 18px;
  display: block;
  background: #f6efe8;
}

.image-placeholder {
  width: 100%;
  min-height: 260px;
  border: 2px dashed #c7b29f;
  border-radius: 18px;
  background: linear-gradient(180deg, #f6efe8 0%, #efe5d9 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--kw-brown-dark);
  text-align: center;
  padding: 20px;
}

.image-placeholder span {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.image-placeholder small {
  font-size: 0.95rem;
  color: var(--kw-brown);
}

.upload-panel {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.upload-btn {
  width: 100%;
}

.item-card-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.item-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.detail-box {
  background: #fcf7f2;
  border: 1px solid #e6d6c6;
  border-radius: 14px;
  padding: 14px;
}

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

.detail-box label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--kw-brown);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.detail-box div {
  font-size: 1rem;
  color: var(--kw-black);
  font-weight: 600;
  line-height: 1.4;
}

.table-section {
  margin-bottom: 60px;
}

.table-wrap {
  overflow-x: auto;
  background: #fffdfb;
  border: 1px solid #cfbead;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(35, 22, 15, 0.08);
}

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

thead th {
  background: #f3ebe3;
  color: var(--kw-brown-dark);
  font-weight: 700;
  font-size: 0.96rem;
  text-align: left;
  padding: 18px 14px;
  border-bottom: 1px solid #d5c3b3;
}

tbody td {
  padding: 14px;
  border-bottom: 1px solid #eadfd4;
  vertical-align: middle;
  background: #fffdfb;
}

tbody tr:hover td {
  background: #fcf7f2;
}

input,
select,
textarea {
  width: 100%;
  min-width: 100px;
  padding: 11px 12px;
  border: 1px solid #bfa48d;
  border-radius: 10px;
  background: #ffffff;
  color: var(--kw-black);
  font-size: 0.95rem;
  outline: none;
  font-family: inherit;
}

textarea {
  resize: vertical;
  min-height: 42px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--kw-brown);
  box-shadow: 0 0 0 3px rgba(122, 90, 67, 0.16);
}

.link-button,
.project-button,
.view-button {
  border: 1px solid #bfa48d;
  border-radius: 10px;
  background: #ffffff;
  color: var(--kw-black);
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
}

.link-button,
.project-button {
  width: 100%;
  padding: 11px 12px;
  text-align: left;
}

.link-button:hover,
.project-button:hover,
.view-button:hover {
  background: #fcf7f2;
  border-color: var(--kw-brown);
}

.project-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.view-button {
  width: 100%;
  padding: 9px 12px;
  text-align: center;
}

.qty-input {
  max-width: 110px;
}

.add-btn,
.reset-btn,
.delete-btn {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
  font-size: 0.96rem;
  cursor: pointer;
  transition: 0.2s ease;
}

.add-btn {
  background: var(--kw-success);
  color: #ffffff;
}

.add-btn:hover {
  background: var(--kw-success-hover);
}

.reset-btn {
  background: #d8c4b2;
  color: var(--kw-black);
}

.reset-btn:hover {
  background: #cdb39d;
}

.delete-btn {
  background: var(--kw-danger);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 10px;
}

.delete-btn:hover {
  background: var(--kw-danger-hover);
}

.badge {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge.received {
  background: #e6d6c6;
  color: #4e3523;
}

.badge.inspection {
  background: #5f4634;
  color: #ffffff;
}

.badge.racked {
  background: #b7c9b2;
  color: #223320;
}

.badge.hold {
  background: #ccb29d;
  color: #3f281b;
}

.badge.delivered {
  background: #8f6a4f;
  color: #ffffff;
}

.badge.damaged {
  background: #d9b0aa;
  color: #6b1f14;
}

.empty-message td {
  text-align: center;
  color: var(--kw-brown);
  font-weight: 700;
  padding: 24px 14px;
}

.site-footer {
  border-top: 1px solid #d8c4b2;
  padding: 28px 0 40px;
  background: #f3ebe3;
}

.site-footer p {
  color: var(--kw-brown-dark);
  font-size: 1rem;
  font-weight: 700;
  max-width: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 19, 17, 0.6);
}

.modal-panel {
  position: relative;
  width: min(980px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  margin: 24px auto;
  background: #fffdfb;
  border: 1px solid #cfbead;
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(35, 22, 15, 0.24);
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 12px;
  border-bottom: 1px solid #eadfd4;
}

.modal-head p {
  color: var(--kw-brown);
  max-width: none;
  font-size: 0.98rem;
}

.close-btn {
  border: none;
  background: #241d19;
  color: #ffffff;
  border-radius: 12px;
  width: 42px;
  height: 42px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.modal-body {
  padding: 18px 22px 22px;
}

.rack-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.summary-chip {
  background: #f3ebe3;
  border: 1px solid #d9c6b3;
  color: var(--kw-brown-dark);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.92rem;
}

.rack-table-wrap {
  overflow-x: auto;
  border: 1px solid #eadfd4;
  border-radius: 16px;
}

.rack-table {
  min-width: 760px;
}

.rack-table th,
.rack-table td {
  padding: 14px 12px;
}

.rack-item-button {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #bfa48d;
  border-radius: 10px;
  background: #ffffff;
  color: var(--kw-black);
  font-size: 0.94rem;
  text-align: left;
  cursor: pointer;
  font-weight: 700;
}

.rack-item-button:hover {
  background: #fcf7f2;
  border-color: var(--kw-brown);
}

/* =========================================================
   WMS TABS
   ========================================================= */
.wms-tabs {
  display: inline-flex;
  background: #e9dfd3;
  padding: 4px;
  border-radius: 14px;
  gap: 4px;
  margin: 18px 0 22px;
}

.wms-tab {
  padding: 8px 16px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #5a4636;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wms-tab:hover {
  background: rgba(122, 79, 42, 0.15);
}

.wms-tab.active {
  background: #7a4f2a;
  color: #ffffff;
}

.wms-tab-panel.hidden {
  display: none;
}

/* =========================================================
   INSTALL DAY
   ========================================================= */
.danger-btn {
  border-color: rgba(255, 90, 90, 0.4);
}

.install-input {
  width: 100%;
  min-width: 110px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #ccb8a3;
  background: #ffffff;
  color: #3f3127 !important;
  -webkit-text-fill-color: #3f3127 !important;
  opacity: 1;
  font: inherit;
}

.install-input::placeholder {
  color: #a79a8d;
  -webkit-text-fill-color: #a79a8d;
}

.install-input:focus {
  outline: none;
  border-color: #8a5a32;
  box-shadow: 0 0 0 2px rgba(138, 90, 50, 0.12);
}

#installDayTable input,
#installDayTable select,
#installDayTable td input.install-input,
#installDayTable td select.install-input {
  color: #3f3127 !important;
  -webkit-text-fill-color: #3f3127 !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  opacity: 1 !important;
}

.install-delete-btn {
  white-space: nowrap;
}

.install-image-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 92px;
}

.install-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #ccb8a3;
  background: #fff;
}

.install-thumb-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 1px dashed #ccb8a3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #8f7b68;
  background: #fff;
  text-align: center;
  padding: 4px;
}

.install-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 8px;
  background: #7a4f2a;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .hero {
    padding: 48px 20px;
  }

  .container {
    padding: 0 16px;
  }

  .search-controls {
    grid-template-columns: 1fr;
  }

  .item-card {
    grid-template-columns: 1fr;
  }

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

  .modal-panel {
    width: calc(100% - 16px);
    margin: 8px auto;
    max-height: calc(100vh - 16px);
  }
}

/* =========================================================
   PRINT
   ========================================================= */
@media print {
  .hero,
  .site-footer,
  .wms-tabs,
  #inventoryTab,
  #installDayAddBtn,
  #installDaySaveBtn,
  #installDayClearBtn,
  #installDayPrintBtn,
  .install-delete-btn,
  .install-upload-btn,
  .install-thumb-placeholder,
  .search-section,
  .button-group {
    display: none !important;
  }

  #installDayTab {
    display: block !important;
  }

  body,
  main,
  .container,
  .table-section,
  .table-wrap {
    background: #fff !important;
    color: #000 !important;
  }

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

  th,
  td {
    color: #000 !important;
    border: 1px solid #ccc;
    padding: 8px;
  }

  .install-input {
    border: none !important;
    background: transparent !important;
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  .install-thumb {
    width: 48px;
    height: 48px;
    border: 1px solid #ccc;
  }
}
