:root {
  --ink: #151a24;
  --ink-soft: #4a5160;
  --ink-faint: #8a90a0;
  --bg: #fafaf8;
  --card: #ffffff;
  --line: #e6e6e1;
  --accent: #151a24;
  --green: #1f7a4d;
  --green-bg: #e7f4ec;
  --red: #a33;
  --red-bg: #f7ecec;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

/* ---------- gate ---------- */
.gate {
  position: fixed; inset: 0; background: var(--ink);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.gate-box { text-align: center; color: #fff; width: 280px; }
.gate-logo { font-size: 28px; letter-spacing: 0.35em; font-weight: 600; }
.gate-sub { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: #b9bec9; margin: 6px 0 28px; }
.gate-box input {
  width: 100%; padding: 12px 14px; border: 1px solid #3a4150; background: #1e2430;
  color: #fff; border-radius: 6px; font-size: 15px; text-align: center; letter-spacing: 0.3em;
}
.gate-box input:focus { outline: none; border-color: #7d8698; }
.gate-box button {
  margin-top: 12px; width: 100%; padding: 12px; background: #fff; color: var(--ink);
  border: none; border-radius: 6px; font-size: 13px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; cursor: pointer;
}
.gate-err { margin-top: 12px; font-size: 12px; color: #ff9c9c; min-height: 16px; }

/* ---------- header ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.brand { white-space: nowrap; }
.brand-name { font-size: 19px; letter-spacing: 0.3em; font-weight: 600; }
.brand-sub { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-faint); margin-left: 10px; }
.search-wrap { flex: 1; max-width: 560px; }
.search-wrap input {
  width: 100%; padding: 9px 14px; border: 1px solid var(--line); border-radius: 20px;
  font-size: 13px; background: var(--bg);
}
.search-wrap input:focus { outline: none; border-color: var(--ink-faint); }
.topbar-meta { font-size: 12px; color: var(--ink-faint); white-space: nowrap; }

/* ---------- mega menu ---------- */
.megabar {
  display: flex; justify-content: center; gap: 4px;
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 57px; z-index: 29;
}
.mega-item { position: relative; }
.mega-item > button {
  padding: 13px 18px; background: none; border: none; font-size: 12.5px;
  letter-spacing: 0.14em; font-weight: 600; color: var(--ink); cursor: pointer;
  border-bottom: 2px solid transparent; text-transform: uppercase;
}
.mega-item > button:hover, .mega-item.active > button { border-bottom-color: var(--ink); }
.mega-drop {
  display: none; position: absolute; left: 50%; transform: translateX(-50%);
  top: 100%; background: #fff; border: 1px solid var(--line); border-top: none;
  box-shadow: 0 12px 28px rgba(21, 26, 36, 0.10); padding: 14px 0; min-width: 230px; z-index: 40;
}
.mega-item:hover .mega-drop { display: block; }
.mega-drop a {
  display: flex; justify-content: space-between; gap: 18px; padding: 8px 20px;
  color: var(--ink-soft); text-decoration: none; font-size: 13px; white-space: nowrap;
}
.mega-drop a:hover { background: var(--bg); color: var(--ink); }
.mega-drop a .n { color: var(--ink-faint); font-size: 11px; }
.mega-drop a.all-link { font-weight: 600; color: var(--ink); }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; flex-wrap: wrap;
}
.crumbs { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }
.crumbs .light { color: var(--ink-faint); font-weight: 400; }
.controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.vendor-pills { display: flex; gap: 6px; }
.vendor-pills button {
  padding: 6px 13px; border-radius: 16px; border: 1px solid var(--line);
  background: #fff; font-size: 12px; cursor: pointer; color: var(--ink-soft);
}
.vendor-pills button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.vendor-pills button.soon { opacity: 0.45; cursor: default; }
.stock-toggle { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-soft); cursor: pointer; }
.controls select {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
  font-size: 12.5px; color: var(--ink);
}

/* ---------- grid ---------- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px; padding: 6px 28px 30px;
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; display: flex; flex-direction: column; position: relative;
  transition: box-shadow 0.15s ease; cursor: pointer; text-decoration: none; color: inherit;
}
.card:hover { box-shadow: 0 10px 24px rgba(21, 26, 36, 0.10); }
.card-img { aspect-ratio: 1; background: #fff; display: flex; align-items: center; justify-content: center; }
.card-img img { width: 100%; height: 100%; object-fit: contain; }
.badge {
  position: absolute; top: 10px; left: 10px; font-size: 10.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 10px; letter-spacing: 0.04em;
}
.badge.in { background: var(--green-bg); color: var(--green); }
.badge.out { background: var(--red-bg); color: var(--red); }
.card-body { padding: 12px 14px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.card-vendor { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.card-name { font-size: 13.5px; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.6em;}
.card-sku { font-size: 11.5px; color: var(--ink-faint); }
.card-dims { font-size: 11.5px; color: var(--ink-soft); min-height: 15px; }
.card-prices { display: flex; gap: 12px; align-items: baseline; margin-top: 6px; }
.price-cost { font-size: 15px; font-weight: 700; }
.price-cost span, .price-retail span { font-size: 10px; font-weight: 600; color: var(--ink-faint); margin-right: 3px; }
.price-retail { font-size: 12.5px; color: var(--ink-soft); }
.price-retail.computed { font-style: italic; }

.load-more-wrap { text-align: center; padding: 0 0 30px; }
#load-more {
  padding: 10px 34px; border: 1px solid var(--ink); background: #fff; color: var(--ink);
  border-radius: 20px; font-size: 12.5px; font-weight: 600; letter-spacing: 0.1em; cursor: pointer;
}
#load-more:hover { background: var(--ink); color: #fff; }

.foot {
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 16px 28px 26px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-faint);
}
.empty { padding: 60px 28px; text-align: center; color: var(--ink-faint); font-size: 14px; grid-column: 1/-1; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .megabar { overflow-x: auto; justify-content: flex-start; top: 0; position: static; }
  .grid { padding: 6px 16px 24px; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .toolbar { padding: 12px 16px; }
}

/* ---------- Project Studio ---------- */
.view-tabs { display: flex; gap: 2px; background: var(--bg); border-radius: 18px; padding: 3px; }
.view-tab {
  border: none; background: none; padding: 7px 16px; border-radius: 15px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft); cursor: pointer;
}
.view-tab.active { background: var(--ink); color: #fff; }

.ps-view-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px 6px; flex-wrap: wrap;
}
.ps-view-head h2 { font-size: 17px; letter-spacing: 0.02em; }
.ps-proj-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ps-btn {
  padding: 8px 16px; border: 1px solid var(--line); background: #fff; border-radius: 16px;
  font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.ps-btn:hover { border-color: var(--ink-faint); }
.ps-btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.ps-btn.ghost { color: var(--ink-faint); }

.ps-layout { display: flex; gap: 20px; padding: 10px 28px 30px; align-items: flex-start; }
.ps-sidebar { width: 250px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.ps-proj { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.ps-proj.active { border-color: var(--ink); }
.ps-proj-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 14px; cursor: pointer; font-weight: 600; font-size: 13.5px;
}
.ps-proj.active .ps-proj-head { background: var(--ink); color: #fff; }
.ps-proj-count { font-size: 11px; color: var(--ink-faint); }
.ps-proj.active .ps-proj-count { color: #cfd4de; }
.ps-rooms { display: none; }
.ps-proj.active .ps-rooms { display: block; border-top: 1px solid var(--line); }
.ps-room {
  display: flex; justify-content: space-between; padding: 8px 14px 8px 22px;
  font-size: 12.5px; color: var(--ink-soft); cursor: pointer;
}
.ps-room:hover { background: var(--bg); }
.ps-room.active { color: var(--ink); font-weight: 600; background: var(--bg); }
.ps-room span { color: var(--ink-faint); font-size: 11px; }

.ps-grid {
  flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px; padding: 6px 28px 26px;
}
.ps-layout .ps-grid { padding: 0; }
.ps-item-card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  position: relative; display: flex; flex-direction: column;
}
.ps-room-label {
  position: absolute; top: 8px; left: 8px; z-index: 2; background: var(--ink); color: #fff;
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 9px;
}
.ps-item-img { aspect-ratio: 1; }
.ps-item-img img { width: 100%; height: 100%; object-fit: contain; }
.ps-item-body { padding: 10px 12px 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.ps-item-vendor { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.ps-item-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.ps-item-sku { font-size: 11px; color: var(--ink-faint); }
.ps-item-price { font-size: 14px; font-weight: 700; }
.ps-item-stock { font-size: 11px; font-weight: 600; }
.ps-item-stock.in { color: var(--green); }
.ps-item-stock.out { color: var(--red); }
.ps-item-qty { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.ps-item-qty input { width: 58px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; }
.ps-item-actions { display: flex; gap: 6px; margin-top: 7px; }
.ps-item-actions button {
  flex: 1; padding: 7px 0; border: 1px solid var(--line); background: #fff; border-radius: 7px;
  font-size: 11.5px; font-weight: 600; cursor: pointer; color: var(--ink);
}
.ps-item-actions button.ghost { color: var(--ink-faint); }
.ps-item-actions button:hover { border-color: var(--ink-faint); }
.ps-proj-subtotal { grid-column: 1/-1; text-align: right; font-size: 13.5px; font-weight: 600; padding: 8px 4px; }
.ps-empty { grid-column: 1/-1; padding: 44px 20px; text-align: center; color: var(--ink-faint); }
.ps-archived-row {
  display: flex; justify-content: space-between; align-items: center; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 13px 18px; margin: 8px 28px; font-size: 13.5px;
}
.ps-archived-row button { padding: 7px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; font-size: 12px; font-weight: 600; }
.ps-archived-row button.ghost { color: var(--red); }

/* card tools (heart / add) */
.card-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; z-index: 2; }
.card-tools button {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  font-size: 14px; line-height: 1; cursor: pointer; color: var(--ink-faint);
  display: flex; align-items: center; justify-content: center;
}
.card-tools button:hover { border-color: var(--ink); color: var(--ink); }
.card-fav.on { color: #c0392b; border-color: #c0392b; }
.card-add { font-weight: 700; }
.card-allocs { margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 6px; }
.card-alloc-row { font-size: 11px; color: var(--ink-soft); }

/* modal */
.ps-modal { position: fixed; inset: 0; background: rgba(21,26,36,0.45); display: none; align-items: center; justify-content: center; z-index: 60; }
.ps-modal.open { display: flex; }
.ps-modal-box { background: #fff; border-radius: 12px; padding: 24px 26px; width: 340px; display: flex; flex-direction: column; gap: 8px; }
.ps-modal-box h3 { font-size: 15px; margin-bottom: 6px; }
.ps-modal-box label { font-size: 11.5px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.ps-modal-box select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13.5px; background: #fff; }
.ps-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* toast */
.ps-toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--ink); color: #fff; padding: 11px 22px; border-radius: 20px; font-size: 13px;
  opacity: 0; transition: all 0.25s ease; z-index: 80; pointer-events: none;
}
.ps-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* quote builder */
.ps-quote-overlay { position: fixed; inset: 0; background: rgba(21,26,36,0.55); z-index: 70; overflow-y: auto; padding: 24px; }
.ps-quote-container { max-width: 820px; margin: 0 auto; background: #fff; border-radius: 12px; overflow: hidden; }
.ps-quote-toolbar {
  display: flex; justify-content: space-between; align-items: center; padding: 13px 20px;
  background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 2;
}
.ps-quote-toolbar button { padding: 8px 15px; border-radius: 7px; border: 1px solid #3a4150; background: #232a38; color: #fff; font-size: 12px; font-weight: 600; cursor: pointer; }
.ps-quote-toolbar .ps-quote-print-btn { background: #fff; color: var(--ink); border-color: #fff; }
.ps-quote-invoice { padding: 36px 44px; font-family: Georgia, "Times New Roman", serif; }
.ps-quote-header { text-align: center; border-bottom: 2px solid var(--ink); padding-bottom: 18px; margin-bottom: 22px; }
.ps-quote-wordmark { font-size: 30px; font-weight: 600; letter-spacing: 10px; color: var(--ink); margin-bottom: 6px; }
.ps-quote-header .company-info { font-size: 11.5px; color: #666; line-height: 1.6; }
.ps-quote-project-name { font-size: 21px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; text-align: center; margin: 10px 0 2px; color: var(--ink); }
.ps-quote-date { font-size: 12px; color: #666; text-align: center; margin-bottom: 14px; }
.ps-quote-room { margin: 18px 0; }
.ps-quote-room-header {
  background: #f5f5f5; padding: 8px 12px; font-weight: 700; text-transform: uppercase;
  font-size: 11px; letter-spacing: 1px; border-bottom: 2px solid var(--ink);
  display: flex; justify-content: space-between;
}
.ps-quote-room-desc textarea {
  width: 100%; min-height: 84px; border: 1px dashed #ccc; border-radius: 6px; padding: 9px 11px;
  font-family: inherit; font-size: 12.5px; line-height: 1.5; resize: vertical;
}
.ps-quote-room-price { display: flex; justify-content: flex-end; align-items: center; padding: 6px 0; }
.ps-quote-room-price input { width: 130px; padding: 7px 9px; border: 1px solid #ccc; border-radius: 6px; font-size: 13.5px; text-align: right; }
.ps-quote-custom-section { margin: 20px 0; }
.ps-quote-custom-header { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; background: #f5f5f5; padding: 8px 12px; border-bottom: 2px solid var(--ink); }
.ps-quote-custom-line { display: flex; align-items: center; gap: 8px; padding: 7px 0; }
.ps-quote-custom-label { flex: 1; padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 12.5px; }
.ps-quote-custom-tax { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: #666; }
.ps-quote-custom-amount { width: 110px; padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 12.5px; text-align: right; }
.ps-quote-custom-remove { width: 28px; height: 28px; border: none; background: none; color: #a33; font-size: 17px; cursor: pointer; }
.ps-quote-add-line-btn { margin-top: 8px; padding: 8px 14px; border: 1px dashed #bbb; background: none; border-radius: 7px; font-size: 12px; color: #666; cursor: pointer; }
.ps-quote-totals { width: 320px; margin-left: auto; margin-top: 18px; border-collapse: collapse; }
.ps-quote-totals td { padding: 6px 10px; font-size: 13px; }
.ps-quote-totals .label { text-align: right; font-weight: 600; color: #444; }
.ps-quote-totals .value { text-align: right; }
.ps-quote-totals .grand-total td { border-top: 2px solid var(--ink); font-size: 15.5px; font-weight: 700; padding-top: 10px; }
.ps-quote-footer { text-align: center; margin-top: 26px; padding-top: 14px; border-top: 1px solid #ddd; font-size: 11px; color: #888; }

@media (max-width: 900px) {
  .ps-layout { flex-direction: column; }
  .ps-sidebar { width: 100%; }
  .view-tabs { order: 3; width: 100%; justify-content: center; }
}

/* ---------- Stately brand skin (navy + gold, per inventory site) ---------- */
:root { --gold: #e8d59f; }
.topbar { background: var(--ink); border-bottom: none; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-sub { color: var(--gold); letter-spacing: 0.22em; line-height: 1; position: relative; top: 1px; }
.search-wrap input { background: #fff; border-color: #fff; }
.topbar-meta { color: #b9bec9; }
.gate-logo-img { width: 240px; margin: 0 auto 4px; display: block; }
.gate-sub { color: var(--gold); }

/* view tabs: white text on navy, gold when active (like My Projects tabs) */
.view-tabs { background: transparent; border-radius: 0; padding: 0; gap: 8px; }
.view-tab {
  background: none; border-radius: 0; color: #fff; padding: 9px 14px 11px;
  border-bottom: 2px solid transparent; letter-spacing: 0.04em;
}
.view-tab:hover { color: var(--gold); }
.view-tab.active { background: none; color: var(--gold); border-bottom-color: var(--gold); }

/* Project Studio hero band */
.ps-band { background: var(--ink); text-align: center; padding: 26px 20px 24px; }
.ps-band-title { color: var(--gold); font-size: 26px; font-weight: 600; letter-spacing: 0.04em; }
.ps-band-sub { color: #fff; font-size: 12.5px; margin-top: 5px; letter-spacing: 0.06em; }

/* gold active states */
.ps-proj.active { border-color: var(--ink); }
.ps-proj.active .ps-proj-head { background: var(--ink); }
.ps-proj.active .ps-proj-name { color: var(--gold); }
.ps-room.active { color: var(--ink); box-shadow: inset 3px 0 0 var(--gold); background: var(--bg); }
.ps-btn.primary { background: var(--ink); color: var(--gold); }
.ps-btn.primary:hover { color: #fff; }
.ps-room-label { background: var(--ink); color: var(--gold); }
.card-tools button.card-add { background: var(--ink); border-color: var(--ink); color: var(--gold); font-size: 16px; }
.card-tools button.card-add:hover { color: #fff; border-color: var(--ink); }
.mega-item > button:hover, .mega-item.active > button { border-bottom-color: var(--gold); }
.vendor-pills button.on { background: var(--ink); border-color: var(--ink); color: var(--gold); }
.ps-quote-toolbar { background: var(--ink); }
.ps-quote-toolbar .ps-quote-print-btn { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.ps-quote-header img { max-width: 260px; margin-bottom: 8px;
  filter: brightness(0) saturate(100%) invert(12%) sepia(30%) saturate(1200%) hue-rotate(195deg) brightness(90%); }
.ps-modal-box select, #ps-modal-qty { padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13.5px; background: #fff; }
#ps-modal-qty { width: 100px; }
#ps-modal-qty-row { display: flex; flex-direction: column; gap: 8px; }
.ps-toast { background: var(--ink); color: var(--gold); }

/* stock states */
.badge.way { background: #fbf0d9; color: #8a6410; }
.card-stockline { font-size: 11px; color: #8a6410; margin-top: 4px; }
