/* ------------------------------------------------------------------ */
/* Variables                                                            */
/* ------------------------------------------------------------------ */
:root {
  --brunswick-green: #1C4E4F;
  --cambridge-blue:  #79A682;
  --celadon:         #B6D2AD;
  --sea-salt:        #F6FAF9;
  --carbon-wing:     #101418;
  --mimosa:          #F2B949;
  --gunmetal:        #142828;
  --mint-cream:      #D7E7E1;
  --white:           #ffffff;
  --border:          #DDE8DC;
  --muted:           #6B7D6B;
  --danger:          #C0392B;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-card: 0 2px 8px rgba(28,78,79,.09), 0 1px 2px rgba(28,78,79,.05);
  --shadow-modal: 0 8px 40px rgba(20,40,40,.22);
}

/* ------------------------------------------------------------------ */
/* Reset & Base                                                         */
/* ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: 'Poppins', sans-serif;
  font-weight: 400;
  color: var(--carbon-wing);
  background: var(--sea-salt);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--cambridge-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { display: block; max-width: 100%; }

ul { list-style: none; }

/* ------------------------------------------------------------------ */
/* Buttons                                                              */
/* ------------------------------------------------------------------ */
.btn-primary {
  background: var(--brunswick-green);
  color: var(--white);
  border: 2px solid var(--brunswick-green);
  padding: .6rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn-primary:hover { opacity: .88; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: var(--brunswick-green);
  border: 2px solid var(--brunswick-green);
  padding: .6rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-outline:hover { background: var(--mint-cream); }

.btn-danger {
  background: var(--danger);
  color: var(--white);
  border: 2px solid var(--danger);
  padding: .5rem 1.2rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
}
.btn-danger:hover { opacity: .88; }

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: .3rem .5rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .8rem;
  transition: color .15s, background .15s;
}
.btn-ghost:hover { color: var(--brunswick-green); background: var(--mint-cream); }

.btn-get-started {
  background: var(--mimosa);
  color: var(--carbon-wing);
  font-family: inherit;
  font-weight: 500;
  font-size: .875rem;
  padding: .65rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  display: inline-block;
  transition: opacity .15s;
}
.btn-get-started:hover { opacity: .88; text-decoration: none; }

/* ------------------------------------------------------------------ */
/* Site Header                                                          */
/* ------------------------------------------------------------------ */
.site-header {
  background: var(--brunswick-green);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.header-inner {
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  flex-shrink: 0;
}
.header-brand img { filter: brightness(0) invert(1); }
.header-title {
  color: var(--white);
  font-weight: 500;
  font-size: 1rem;
  white-space: nowrap;
}
.header-search {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
}
.header-search input {
  width: 100%;
  padding: .5rem 1rem;
  border: none;
  border-radius: 20px;
  font-family: inherit;
  font-size: .875rem;
  background: rgba(255,255,255,.15);
  color: var(--white);
}
.header-search input::placeholder { color: rgba(255,255,255,.65); }
.header-search input:focus {
  outline: none;
  background: rgba(255,255,255,.25);
}
.header-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
  margin-left: auto;
}
.header-user-name {
  color: rgba(255,255,255,.85);
  font-size: .8rem;
}
.header-sign-out {
  background: transparent;
  border: 1px solid rgba(255,255,255,.5);
  color: var(--white);
  font-family: inherit;
  font-size: .8rem;
  padding: .3rem .75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.header-sign-out:hover { background: rgba(255,255,255,.1); }
.header-admin-link {
  color: rgba(255,255,255,.75);
  font-size: .8rem;
  text-decoration: none;
  padding: .3rem .6rem;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.header-admin-link:hover { background: rgba(255,255,255,.1); color: var(--white); text-decoration: none; }

/* ------------------------------------------------------------------ */
/* Catalogue Layout                                                     */
/* ------------------------------------------------------------------ */
.catalogue-layout {
  display: flex;
  flex: 1;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

/* ------------------------------------------------------------------ */
/* Sidebar                                                              */
/* ------------------------------------------------------------------ */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  min-height: calc(100vh - 56px);
}
.sidebar-heading {
  padding: 0 1.25rem .75rem;
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidebar-list { padding: 0 .5rem; }
.sidebar-list li { }
.sidebar-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .875rem;
  color: var(--carbon-wing);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.sidebar-item:hover { background: var(--mint-cream); color: var(--brunswick-green); }
.sidebar-item.active {
  background: var(--celadon);
  color: var(--brunswick-green);
  font-weight: 500;
}

/* ------------------------------------------------------------------ */
/* Main Catalogue Area                                                  */
/* ------------------------------------------------------------------ */
.catalogue-main {
  flex: 1;
  padding: 1.5rem 2rem;
  overflow: hidden;
}
.main-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.category-section { margin-bottom: 2.5rem; }
.category-section-heading {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--brunswick-green);
  margin-bottom: .25rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--border);
}
.subcategory-heading {
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted);
  margin: 1rem 0 .5rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
}

/* ------------------------------------------------------------------ */
/* Item Card                                                            */
/* ------------------------------------------------------------------ */
.item-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: .75rem;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
  position: relative;
  display: flex;
  flex-direction: column;
}
.item-card:hover {
  box-shadow: var(--shadow-card);
  border-color: var(--cambridge-blue);
}
.item-card-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: var(--sea-salt);
  border-radius: var(--radius-sm);
  margin-bottom: .5rem;
}
.item-card-image-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: var(--sea-salt);
  border-radius: var(--radius-sm);
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--celadon);
  font-size: 2rem;
}
.item-card-name {
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: .2rem;
  color: var(--carbon-wing);
}
.item-card-part {
  font-size: .7rem;
  color: var(--muted);
}
.item-card-actions {
  position: absolute;
  top: .4rem;
  right: .4rem;
  display: none;
  gap: .2rem;
}
.item-card:hover .item-card-actions { display: flex; }
.card-action-btn {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .85rem;
  color: var(--muted);
  transition: background .12s, color .12s;
}
.card-action-btn:hover { background: var(--mint-cream); color: var(--brunswick-green); }
.card-action-btn.danger:hover { background: #FDECEA; color: var(--danger); }

/* ------------------------------------------------------------------ */
/* Item Detail Page                                                     */
/* ------------------------------------------------------------------ */
.detail-page {
  max-width: 1440px;
  margin: 2rem auto;
  padding: 0 2rem;
}
.breadcrumb {
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  align-items: center;
}
.breadcrumb a { color: var(--cambridge-blue); }
.breadcrumb .sep { color: var(--muted); }

.detail-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  transition: opacity .22s ease, transform .22s ease;
}
.detail-card.nav-exit      { opacity: 0; }
.detail-card.nav-exit-left  { transform: translateX(-44px); }
.detail-card.nav-exit-right { transform: translateX(44px); }
.detail-card.nav-enter-from-left  { opacity: 0; transform: translateX(44px);  transition: none; }
.detail-card.nav-enter-from-right { opacity: 0; transform: translateX(-44px); transition: none; }

/* Item carousel navigation */
.item-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  min-height: 2.4rem;
}
.item-nav-btn {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .35rem .7rem;
  font-size: .8rem;
  color: var(--cambridge-blue);
  cursor: pointer;
  transition: background .12s, border-color .12s;
  max-width: 38%;
}
.item-nav-btn:hover:not(:disabled) { background: var(--sea-salt); border-color: var(--cambridge-blue); }
.item-nav-btn:disabled { opacity: .35; cursor: default; }
.item-nav-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.item-nav-arrow { flex-shrink: 0; font-size: .95rem; }
.item-nav-counter { font-size: .78rem; color: var(--muted); }
.detail-layout {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.detail-image-col {
  flex: 0 0 280px;
}
.detail-main-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: var(--sea-salt);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.detail-image-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: var(--sea-salt);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: var(--celadon);
}
/* Image gallery */
.detail-main-image-zoomable { cursor: zoom-in; }
.detail-gallery {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-top: .6rem;
  padding: .5rem;
  background: var(--sea-salt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.detail-gallery-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  cursor: zoom-in;
  transition: border-color .12s, transform .12s;
}
.detail-gallery-thumb:hover  { border-color: var(--cambridge-blue); transform: scale(1.06); }
.detail-gallery-thumb.active { border-color: var(--brunswick-green); }

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16,20,24,.88);
}
.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
}
.lightbox-img {
  max-width: 88vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.lightbox-caption {
  color: rgba(255,255,255,.75);
  font-size: .85rem;
  text-align: center;
}
.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  z-index: 2;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  opacity: .8;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-arrow {
  position: relative;
  z-index: 2;
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  font-size: 1.6rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .12s;
  margin: 0 .75rem;
}
.lightbox-arrow:hover { background: rgba(255,255,255,.25); }
body.lightbox-open { overflow: hidden; }

.detail-info-col { flex: 1; min-width: 260px; }
.detail-name {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--brunswick-green);
  margin-bottom: .25rem;
}
.detail-part {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.detail-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.detail-table tr { border-bottom: 1px solid var(--border); }
.detail-table tr:last-child { border-bottom: none; }
.detail-table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  padding: .55rem .5rem .55rem 0;
  width: 35%;
  white-space: nowrap;
}
.detail-table td { padding: .55rem 0; color: var(--carbon-wing); }
.detail-description { margin-top: 1rem; }
.detail-tagline {
  font-size: .9rem;
  color: var(--cambridge-blue);
  margin: 0 0 .75rem;
  font-weight: 400;
}
.btn-outline-danger { color: var(--danger); border-color: var(--danger); }
.btn-outline-danger:hover { background: #fdecea; }

.detail-spec-heading th {
  padding-top: 1rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 500;
}
.detail-specs tr th,
.detail-specs tr td { border-top: 1px solid var(--border); }
.detail-specs tr:first-child th,
.detail-specs tr:first-child td { border-top: none; }

.detail-notes {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--sea-salt);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  line-height: 1.6;
}
.detail-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* Top action bar on detail page */
.detail-top-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.25rem;
}

/* Inactive product alert banner */
.item-inactive-alert {
  background: #fdecea;
  border: 1px solid #f5c6c2;
  color: #b91c1c;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}

/* Inactive card overlay */
.item-card-inactive-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(192,57,43,.85);
  color: #fff;
  font-size: .65rem;
  font-weight: 500;
  text-align: center;
  padding: .2rem .5rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  pointer-events: none;
  z-index: 1;
}
.item-card--inactive { opacity: .75; }

/* Active/Inactive toggle in modal */
.form-label--toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  color: var(--carbon-wing);
}
.form-label--toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--brunswick-green);
}

/* ------------------------------------------------------------------ */
/* Modal                                                                */
/* ------------------------------------------------------------------ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,40,40,.45);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  padding: 2rem;
  box-shadow: var(--shadow-modal);
  position: relative;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.modal-title { font-size: 1.1rem; font-weight: 500; }
.modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: .2rem;
}
.modal-close:hover { color: var(--carbon-wing); }

/* Import section */
.import-section {
  background: var(--sea-salt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.import-section-title {
  font-size: .8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: .75rem;
}
.import-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}
.import-row input[type="text"] {
  flex: 1;
  min-width: 180px;
}
.import-row input[type="file"] { display: none; }
.import-status {
  font-size: .8rem;
  color: var(--cambridge-blue);
  margin-top: .5rem;
  min-height: 1.2rem;
}
.source-url-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}
.source-url-label {
  font-size: .75rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.source-url-input {
  flex: 1;
  min-width: 160px;
  font-size: .8rem;
}

/* Form */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-bottom: .75rem;
}
.form-row.single { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--muted);
}
.form-control {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
  font-family: inherit;
  font-size: .875rem;
  color: var(--carbon-wing);
  background: var(--white);
  transition: border-color .12s;
}
.form-control:focus { outline: none; border-color: var(--cambridge-blue); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

/* Image upload */
.image-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  margin-bottom: .5rem;
}
.image-upload-area:hover { border-color: var(--cambridge-blue); background: var(--sea-salt); }
.image-upload-area p { font-size: .8rem; color: var(--muted); pointer-events: none; }
.image-upload-area input[type="file"] { display: none; }
.image-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .5rem;
}
.image-preview-item {
  position: relative;
  width: 70px;
  height: 70px;
}
.image-preview-item img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.image-preview-header-badge {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--brunswick-green);
  color: #fff;
  font-size: .6rem;
  text-align: center;
  padding: 1px 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  pointer-events: none;
}
.image-preview-item.is-header .image-preview-header-badge { display: block; }
.image-preview-item.is-header img { border-color: var(--cambridge-blue); }

.form-hint { font-weight: 400; color: var(--muted); font-size: .78rem; }

.image-preview-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: .7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Category row with add button */
.category-row { display: flex; gap: .5rem; align-items: flex-end; }
.category-row select { flex: 1; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.autosave-status {
  margin-right: auto;
  align-self: center;
  font-size: .8rem;
  color: var(--muted);
}
.autosave-status.is-saving { color: var(--muted); }
.autosave-status.is-saved  { color: var(--cambridge-blue); }
.autosave-status.is-error  { color: var(--danger); }

/* Spec section (collapsible) */
.spec-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: 1rem 0 .5rem;
}
.spec-section-title {
  padding: .65rem 1rem;
  font-size: .85rem;
  font-weight: 500;
  color: var(--brunswick-green);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.spec-section-title::-webkit-details-marker { display: none; }
.spec-section-title::before { content: '▸ '; font-size: .7rem; }
.spec-section[open] > .spec-section-title::before { content: '▾ '; }
.spec-section > .form-row {
  padding: 0 1rem;
  margin-top: .75rem;
}
.spec-section > .form-row:last-of-type { padding-bottom: 1rem; }

/* Product highlights (features) modal UI */
.features-list { padding: .5rem 1rem 0; }
.feature-row {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
}
.feature-row:last-child { border-bottom: none; }
.feature-num {
  font-size: .7rem;
  font-weight: 500;
  color: var(--cambridge-blue);
  min-width: 1.5rem;
  padding-top: .55rem;
  flex-shrink: 0;
}
.feature-inputs { flex: 1; display: flex; flex-direction: column; gap: .35rem; }
.feature-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: .3rem .4rem;
  line-height: 1;
  flex-shrink: 0;
}
.feature-remove:hover { color: var(--danger); }
.features-add-btn { margin: .5rem 1rem .75rem; }

/* ------------------------------------------------------------------ */
/* Confirm dialog                                                       */
/* ------------------------------------------------------------------ */
.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,40,40,.45);
  z-index: 1100;
  align-items: center;
  justify-content: center;
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1.75rem 2rem;
  max-width: 360px;
  width: 90%;
  box-shadow: var(--shadow-modal);
  text-align: center;
}
.confirm-box p { font-size: .95rem; margin-bottom: 1.5rem; }
.confirm-actions { display: flex; gap: .75rem; justify-content: center; }

/* ------------------------------------------------------------------ */
/* Toast                                                                */
/* ------------------------------------------------------------------ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  background: var(--brunswick-green);
  color: var(--white);
  padding: .7rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: .85rem;
  box-shadow: var(--shadow-card);
  animation: slideIn .2s ease;
  max-width: 320px;
}
.toast.error { background: var(--danger); }
@keyframes slideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ------------------------------------------------------------------ */
/* Login page                                                           */
/* ------------------------------------------------------------------ */
.login-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  background: var(--sea-salt);
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.login-logo {
  width: 52px;
  height: 52px;
  margin: 0 auto 1rem;
}
.login-title {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--brunswick-green);
  margin-bottom: .4rem;
}
.login-sub {
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: 2rem;
}
.login-datetime {
  font-size: .8rem;
  color: var(--muted);
  margin-top: -1.4rem;
  margin-bottom: 1.6rem;
}
.login-btn {
  width: 100%;
  padding: .85rem;
  font-size: .95rem;
  border-radius: var(--radius-sm);
}

/* ------------------------------------------------------------------ */
/* Footer                                                               */
/* ------------------------------------------------------------------ */
.site-footer {
  background: var(--brunswick-green);
  color: var(--white);
  margin-top: auto;
  position: relative;
  overflow: hidden;
}
.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-tagline { font-size: .95rem; }
.footer-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 2rem;
}
.footer-logo { margin-bottom: .75rem; opacity: .9; }
.footer-contact {
  font-size: .8rem;
  color: rgba(255,255,255,.65);
  line-height: 1.8;
  margin-bottom: .5rem;
}
.footer-vesta { font-size: .75rem; color: rgba(255,255,255,.4); }
.footer-col-heading {
  font-size: .65rem;
  letter-spacing: .1em;
  font-weight: 500;
  color: rgba(255,255,255,.4);
  margin-bottom: .75rem;
}
.footer-links-col ul { display: flex; flex-direction: column; gap: .45rem; }
.footer-links-col a {
  font-size: .8rem;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  transition: color .12s;
}
.footer-links-col a:hover { color: var(--white); text-decoration: none; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: .85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .72rem;
  color: rgba(255,255,255,.35);
}
.footer-linkedin { color: rgba(255,255,255,.45); transition: color .12s; }
.footer-linkedin:hover { color: var(--white); }
.footer-watermark {
  position: absolute;
  right: -40px;
  bottom: -20px;
  width: 260px;
  opacity: .06;
  pointer-events: none;
  transform: rotate(10deg);
}
.footer-watermark img { width: 100%; }

/* ------------------------------------------------------------------ */
/* Skeleton / loading                                                   */
/* ------------------------------------------------------------------ */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--sea-salt) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

.loading-gif {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(246,250,249,.92);
  z-index: 50;
}
.loading-gif img { width: 120px; height: 120px; }

.loading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
}
.skeleton-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: .75rem;
}
.skeleton-img  { width: 100%; aspect-ratio: 1; margin-bottom: .5rem; }
.skeleton-line { height: .7rem; margin-bottom: .3rem; }
.skeleton-line.short { width: 60%; }

/* ------------------------------------------------------------------ */
/* Utility                                                              */
/* ------------------------------------------------------------------ */
.hidden { display: none !important; }
.text-muted { color: var(--muted); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 2rem; }

.skeleton-sidebar { margin: .5rem .75rem; height: .9rem; }
.skeleton-sidebar.narrow { width: 70%; }

.skeleton-detail-img   { aspect-ratio: 1; border-radius: 10px; }
.skeleton-detail-title { height: 1.6rem; margin-bottom: .5rem; width: 70%; }
.skeleton-detail-sub   { height: .9rem; width: 40%; margin-bottom: 1.5rem; }
.skeleton-detail-body  { height: .85rem; margin-bottom: .4rem; }
.skeleton-detail-body.w75 { width: 75%; }
.skeleton-detail-body.w55 { width: 55%; }

/* ------------------------------------------------------------------ */
/* Catalogue search bar                                                 */
/* ------------------------------------------------------------------ */
.catalogue-search-bar {
  margin-bottom: 1rem;
}
.catalogue-search-label {
  display: block;
  font-size: .75rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: .4rem;
}
.catalogue-search-input-wrap {
  position: relative;
}
.catalogue-search-icon {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}
.catalogue-search-input {
  width: 100%;
  padding: .65rem .9rem .65rem 2.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
  font-size: .9rem;
  font-weight: 400;
  color: var(--carbon-wing);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  box-shadow: 0 1px 2px rgba(28,78,79,.04);
}
.catalogue-search-input::placeholder { color: var(--muted); }
.catalogue-search-input:focus {
  outline: none;
  border-color: var(--cambridge-blue);
  box-shadow: 0 0 0 3px rgba(121,166,130,.18);
}

.btn-file-label { cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; }

/* ------------------------------------------------------------------ */
/* Responsive                                                           */
/* ------------------------------------------------------------------ */
@media (max-width: 900px) {
  .footer-body { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .catalogue-layout { flex-direction: column; }
  .sidebar { width: 100%; min-height: auto; border-right: none; border-bottom: 1px solid var(--border); padding: .75rem 0; }
  .catalogue-main { padding: 1rem; }
  .detail-layout { flex-direction: column; }
  .detail-image-col { flex: none; width: 100%; max-width: 320px; margin: 0 auto; }
  .form-row { grid-template-columns: 1fr; }
  .footer-body { grid-template-columns: 1fr; gap: 1.5rem; }
  .header-search { display: none; }
}

/* ------------------------------------------------------------------ */
/* Filter bar                                                           */
/* ------------------------------------------------------------------ */

.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem .6rem;
  padding: .5rem 1rem;
  background: var(--sea-salt);
  border-bottom: 1px solid var(--border);
  margin-bottom: .75rem;
}

.filter-bar-heading {
  font-size: .7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-right: .25rem;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
}

.filter-label-text {
  color: var(--muted);
  white-space: nowrap;
  font-size: .75rem;
}

.filter-select {
  font-family: 'Poppins', sans-serif;
  font-size: .78rem;
  padding: .25rem .55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--carbon-wing);
  cursor: pointer;
  min-width: 100px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-select.filter-active {
  border-color: var(--brunswick-green);
  background: #e8f0e9;
  color: var(--brunswick-green);
  font-weight: 500;
}

.filter-clear-btn {
  font-family: 'Poppins', sans-serif;
  font-size: .75rem;
  padding: .25rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  margin-left: auto;
}

.filter-clear-btn:hover { border-color: #c44; color: #c44; background: #fff5f5; }

/* ------------------------------------------------------------------ */
/* Audit log page                                                       */
/* ------------------------------------------------------------------ */

.audit-page {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem 4rem;
}

.audit-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.audit-title {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--brunswick-green);
  margin: 0 0 .2rem;
}

.audit-sub {
  font-size: .85rem;
  color: var(--muted);
  margin: 0;
}

.audit-toolbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.audit-count {
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: .75rem;
}

.audit-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

.audit-table thead th {
  background: var(--sea-salt);
  color: var(--brunswick-green);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .65rem .9rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.audit-table tbody tr:hover { background: #f9fcf9; }

.audit-table tbody tr + tr td { border-top: 1px solid var(--border); }

.audit-table td {
  padding: .55rem .9rem;
  vertical-align: middle;
  color: var(--carbon);
}

.audit-td-date  { white-space: nowrap; color: var(--muted); font-size: .78rem; }
.audit-td-id    { font-family: monospace; font-size: .75rem; color: var(--muted); }
.audit-td-name  { font-weight: 500; }
.audit-td-details { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .78rem; }

.audit-item-link { color: var(--brunswick-green); text-decoration: none; }
.audit-item-link:hover { text-decoration: underline; }

/* Action badges */
.audit-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 500;
  padding: .15rem .55rem;
  border-radius: 20px;
  white-space: nowrap;
}

.audit-badge-create  { background: #e2f5e8; color: #1a6632; }
.audit-badge-update  { background: #e8f0fb; color: #1a4a9e; }
.audit-badge-delete  { background: #fdecea; color: #b91c1c; }
.audit-badge-upload  { background: #fef3e2; color: #92530a; }
.audit-badge-default { background: var(--sea-salt); color: var(--muted); }

/* Header nav link */
.header-nav-link {
  font-size: .82rem;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  padding: .2rem .4rem;
  border-radius: var(--radius);
  transition: color .15s;
}
.header-nav-link:hover { color: #fff; }

/* ------------------------------------------------------------------ */
/* Print / PDF export                                                   */
/* ------------------------------------------------------------------ */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  @page { size: A4; margin: 0; }
  body > *:not(#print-doc) { display: none !important; }
  body { margin: 0; background: #fff; }
  /* Flex column so footer can be pushed to the bottom of the page */
  #print-doc { display: flex; flex-direction: column; min-height: 297mm; font-family: 'Poppins', sans-serif; font-size: 14px; }

  /* Header bar */
  .pd-bar {
    display: flex; align-items: center; justify-content: space-between;
    background: #1C4E4F; padding: .65rem 1.6rem;
  }
  .pd-bar-brand { display: flex; align-items: center; gap: .65rem; }
  .pd-bar-brand svg { width: 36px; height: 46px; flex-shrink: 0; }
  .pd-bar-name    { font-size: .8rem; font-weight: 500; color: #fff; letter-spacing: .04em; }
  .pd-bar-right   { text-align: right; }
  .pd-bar-product { font-size: .78rem; font-weight: 500; color: #fff; margin-bottom: .1rem; }
  .pd-bar-label   { font-size: .48rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.75); }

  /* Hero */
  .pd-hero {
    display: flex; align-items: flex-start; gap: 2rem;
    background: #1C4E4F; padding: 2.5rem 1.6rem 2rem; min-height: 200px;
  }
  .pd-hero-text { flex: 1; }
  .pd-hero-cat     { font-size: .56rem; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: #79A682; margin-bottom: .75rem; }
  .pd-hero-name    { font-size: 3.5rem; font-weight: 500; color: #fff; margin: 0 0 .5rem; line-height: 1.05; }
  .pd-hero-tagline { font-size: 1rem; font-weight: 400; color: #79A682; margin: 0 0 .9rem; line-height: 1.3; }
  .pd-hero-desc    { font-size: .78rem; font-weight: 400; color: rgba(255,255,255,.75); margin: 0; line-height: 1.65; max-width: 36rem; }
  .pd-hero-img-wrap { flex: 0 0 260px; display: flex; align-items: flex-start; justify-content: flex-end; }
  .pd-hero-img { max-width: 240px; max-height: 240px; object-fit: contain; background: rgba(255,255,255,.08); border-radius: 6px; padding: .65rem; }

  /* Identity band */
  .pd-identity {
    display: flex; align-items: center; gap: 1.5rem;
    background: #F6FAF9; border-bottom: 1px solid #D7E7E1; padding: 1rem 1.6rem;
    break-inside: avoid;
  }
  .pd-id-main   { flex: 0 0 auto; max-width: 38%; }
  .pd-id-cat    { font-size: .5rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: #79A682; margin-bottom: .15rem; }
  .pd-id-part   { font-size: 1.4rem; font-weight: 500; color: #1C4E4F; line-height: 1.15; overflow-wrap: anywhere; }
  .pd-id-divider { width: 1px; background: #C8DEDA; align-self: stretch; flex-shrink: 0; }
  .pd-id-detail  { flex: 1; min-width: 0; }
  .pd-id-name    { font-size: .78rem; font-weight: 500; color: #142828; }
  .pd-id-tagline { font-size: .72rem; font-weight: 400; color: #4e6e50; margin-top: .15rem; }
  .pd-id-meta    { display: flex; flex-direction: column; gap: .15rem; flex-shrink: 0; text-align: right; }
  .pd-id-meta span { font-size: .65rem; color: #3d5c3f; font-weight: 500; }

  /* Shared eyebrow label */
  .pd-eyebrow { font-size: .52rem; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: #79A682; margin-bottom: .5rem; }

  /* Features */
  .pd-features { padding: 1.4rem 1.6rem; background: #fff; }
  .pd-features-heading { font-size: 1.2rem; font-weight: 500; color: #1C4E4F; margin: 0 0 1.1rem; line-height: 1.2; }
  .pd-features-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
  .pd-feature-card {
    display: flex; gap: .65rem; align-items: flex-start;
    border: 1px solid #D7E7E1; border-radius: 4px; padding: .65rem; background: #F6FAF9;
    break-inside: avoid;
  }
  .pd-feature-num   { font-size: .62rem; font-weight: 500; color: #79A682; flex-shrink: 0; padding-top: .05rem; min-width: 1.2rem; }
  .pd-feature-title { font-size: .73rem; font-weight: 500; color: #142828; margin-bottom: .18rem; }
  .pd-feature-body  { font-size: .65rem; font-weight: 400; color: #4e6a50; line-height: 1.5; }

  /* Spec section — keep rows and group headings together across page breaks */
  .pd-spec-section { padding: 1.25rem 1.6rem 1.4rem; background: #fff; }
  .pd-spec-table { width: 100%; border-collapse: collapse; font-size: .72rem; border: 1px solid #D7E7E1; }
  .pd-spec-table tr  { break-inside: avoid; }
  .pd-spec-group     { break-after: avoid; }
  .pd-spec-group th {
    background: #142828; color: #B6D2AD;
    font-size: .5rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase;
    padding: .38rem .75rem; text-align: left;
  }
  .pd-spec-table tr:not(.pd-spec-group) th {
    background: #F6FAF9; color: #142828; font-weight: 500;
    width: 36%; padding: .36rem .75rem;
    border-bottom: 1px solid #D7E7E1; border-right: 2px solid #1C4E4F;
    white-space: nowrap; text-align: left;
  }
  .pd-spec-table tr:not(.pd-spec-group) td {
    padding: .36rem .75rem; color: #101418;
    border-bottom: 1px solid #D7E7E1; background: #fff;
  }

  /* Notes */
  .pd-notes-section { padding: 0 1.6rem 1.25rem; background: #fff; }
  .pd-notes {
    background: #F6FAF9; border-left: 3px solid #79A682; border-radius: 0 4px 4px 0;
    padding: .7rem 1rem; font-size: .73rem; color: #142828; line-height: 1.65;
    break-inside: avoid;
  }

  /* Footer — pushed to bottom of page via flex margin-top: auto */
  .pd-footer {
    margin-top: auto;
    display: flex; align-items: center; justify-content: space-between;
    background: #1C4E4F; padding: .85rem 1.6rem;
  }
  .pd-footer-eyebrow  { font-size: .5rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: #79A682; margin-bottom: .22rem; }
  .pd-footer-cta      { font-size: .88rem; font-weight: 500; color: #F6FAF9; margin-bottom: .22rem; }
  .pd-footer-contacts { font-size: .56rem; font-weight: 400; color: rgba(255,255,255,.6); letter-spacing: .02em; }
  .pd-footer-logo svg { width: 42px; height: 54px; opacity: .3; }
}

/* ------------------------------------------------------------------ */
/* Archived items                                                        */
/* ------------------------------------------------------------------ */
.item-card--archived {
  opacity: .65;
  filter: grayscale(.4);
  cursor: default;
}
.item-card-archived-banner {
  background: rgba(80, 80, 80, .82) !important;
}
.archived-section-heading {
  color: var(--muted);
}
.archived-empty {
  color: var(--muted);
  font-size: .875rem;
}

/* Show archived toggle active state */
.btn-outline.btn-active {
  background: var(--mint-cream);
  border-color: var(--cambridge-blue);
  color: var(--brunswick-green);
}

/* Audit back button */
.audit-back-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
