/* ===============================================
   LUSTRE — COMPONENTS
   Reusable, brand-consistent UI building blocks.
   =============================================== */

/* ====== BUTTONS ====== */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 11px 22px;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  letter-spacing: var(--tracking-loose);
  text-transform: uppercase;
  font-weight: 500;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--ivory);
  cursor: pointer;
  transition: all var(--t-base);
  text-decoration: none;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--gold-deep); border-color: var(--gold-deep); color: var(--ivory); }
.btn:active { transform: translateY(1px); }

.btn-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
}
.btn-gold:hover { background: var(--gold-deep); border-color: var(--gold-deep); color: var(--ivory); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--ivory); }

.btn-danger {
  background: var(--bordeaux);
  border-color: var(--bordeaux);
  color: var(--ivory);
}
.btn-danger:hover { background: var(--bordeaux-soft); }

.btn-icon {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--charcoal);
  padding: 6px 12px;
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-medium);
  cursor: pointer;
  transition: all var(--t-fast);
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  font-weight: 500;
  white-space: nowrap;
}
.btn-icon:hover { border-color: var(--ink); color: var(--ink); background: var(--paper); }

.btn-sm { padding: 7px 14px; font-size: 0.66rem; letter-spacing: var(--tracking-medium); }
.btn-lg { padding: 14px 28px; font-size: 0.78rem; }

.btn-block { width: 100%; justify-content: center; }

/* ====== BADGES ====== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px 11px;
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--charcoal);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge.available { color: var(--emerald); border-color: var(--emerald); background: var(--emerald-pale); }
.badge.reserved { color: var(--gold-deep); border-color: var(--gold); background: var(--gold-pale); }
.badge.authenticating { color: var(--slate); border-color: var(--slate); background: rgba(107,122,143,0.06); }
.badge.sold { color: var(--charcoal); border-color: var(--charcoal); background: var(--ivory-deep); }
.badge.consignment { color: var(--st-consignment); border-color: var(--st-consignment); }
.badge.service { color: var(--slate); border-color: var(--slate); }
.badge.warning { color: var(--bordeaux); border-color: var(--bordeaux); background: var(--bordeaux-pale); }

/* type chip — for category tagging */
.chip-type {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-deep);
  border: 1px solid var(--gold-soft);
  background: rgba(212, 194, 143, 0.12);
  font-weight: 500;
  border-radius: var(--radius-sm);
}

/* ====== CARDS ====== */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--sp-7);
  transition: all var(--t-base);
}
.card-bordered-gold { border-top: 2px solid var(--gold); }
.card-hoverable:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-6) var(--sp-7);
  border-bottom: 1px solid var(--line);
  background: var(--ivory-soft);
}

.card-body { padding: var(--sp-7); }

/* ====== FORM CONTROLS ====== */
.field {
  display: flex; flex-direction: column;
  gap: var(--sp-2);
}

.field-label {
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-medium);
  text-transform: uppercase;
  color: var(--charcoal);
  font-weight: 500;
}
.field-label .opt {
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.72rem;
  margin-left: 6px;
  font-style: italic;
}

.field-input {
  background: var(--ivory);
  border: 1px solid var(--line);
  padding: 10px 14px;
  font-size: var(--fs-base);
  color: var(--ink);
  border-radius: var(--radius-sm);
  transition: all var(--t-fast);
  font-family: var(--font-sans);
  width: 100%;
  font-weight: 400;
}
.field-input:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--paper);
}
.field-input.readonly,
.field-input[readonly] {
  background: var(--ivory-deep);
  color: var(--charcoal);
  cursor: default;
}

textarea.field-input {
  resize: vertical;
  min-height: 70px;
  line-height: var(--lh-normal);
}

select.field-input { cursor: pointer; }

.field-helper {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.field-error {
  font-size: var(--fs-sm);
  color: var(--bordeaux);
  margin-top: 4px;
}

/* form grid */
.form-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); }
@media (min-width: 600px) {
  .form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ====== TABLES ====== */
.table {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-collapse: collapse;
}
.table thead th {
  background: var(--ivory-deep);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
}
.table thead th:hover { color: var(--ink); }
.table tbody td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 0.92rem;
}
.table tbody tr {
  cursor: pointer;
  transition: background var(--t-fast);
}
.table tbody tr:hover { background: var(--ivory); }
.table tbody tr:last-child td { border-bottom: none; }

.empty-row td {
  text-align: center;
  padding: 60px 20px !important;
  color: var(--muted);
  font-style: italic;
  cursor: default;
}
.empty-row:hover { background: transparent !important; }

/* ====== SEARCH BAR ====== */
.search-bar {
  display: flex; align-items: center;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius-sm);
  transition: border-color var(--t-fast);
}
.search-bar:focus-within { border-color: var(--gold); }
.search-bar .icon {
  padding: 0 14px;
  color: var(--muted);
}
.search-bar input {
  border: none;
  background: transparent;
  padding: 9px 14px 9px 0;
  font-size: 0.85rem;
  outline: none;
  width: 100%;
  color: var(--ink);
}
.search-bar input::placeholder {
  color: var(--muted);
  font-style: italic;
}

/* ====== TABS (top-level navigation between filters within a module) ====== */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--sp-7);
  overflow-x: auto;
  scrollbar-width: none;
  list-style: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  background: transparent;
  border: none;
  padding: 14px 22px;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--t-fast);
  font-weight: 500;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--ink); border-bottom-color: var(--gold); }
.tab-btn .badge-num {
  background: var(--ivory-deep);
  color: var(--charcoal);
  font-size: 0.6rem;
  padding: 1px 6px;
  border-radius: 8px;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.tab-btn.active .badge-num { background: var(--gold-pale); color: var(--gold-deep); }

/* ====== MODAL ====== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 29, 36, 0.5);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.modal-overlay.show { display: flex; animation: fadeIn 0.15s; }

.modal-box {
  background: var(--paper);
  box-shadow: var(--shadow-xl);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.modal-box.lg { max-width: 960px; }
.modal-box.xl { max-width: 1200px; }

.modal-header {
  background: var(--ink);
  color: var(--ivory);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: var(--tracking-tight);
}
.modal-close {
  color: var(--ivory);
  font-size: 1.5rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--t-fast);
  cursor: pointer;
}
.modal-close:hover { background: rgba(247, 243, 236, 0.1); }

.modal-body {
  padding: var(--sp-7);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--sp-5) var(--sp-7);
  background: var(--ivory);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* ====== TOAST ====== */
#toast-area {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}
.toast-item {
  background: var(--ink);
  color: var(--ivory);
  padding: 12px 22px;
  border-left: 3px solid var(--gold);
  font-size: 0.84rem;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: slideUp 0.25s;
}

/* ====== KPI CELLS ====== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.kpi-cell {
  background: var(--paper);
  padding: 22px 20px;
}
.kpi-label {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 12px;
}
.kpi-value {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1;
  letter-spacing: var(--tracking-tighter);
}
.kpi-value .currency {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 400;
  margin-right: 4px;
  vertical-align: top;
  line-height: 2.2;
}
.kpi-meta {
  font-size: 0.78rem;
  color: var(--charcoal);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.kpi-meta .delta-up { color: var(--emerald); }
.kpi-meta .delta-down { color: var(--bordeaux); }

/* ====== SECTION HEADERS ====== */
.section-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin: var(--sp-9) 0 var(--sp-6);
}
.section-divider h3 {
  margin: 0;
  font-style: italic;
  font-weight: 500;
  white-space: nowrap;
}
.section-divider .line {
  flex: 1;
  height: 1px;
  background: var(--line);
}
.section-divider .action {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-deep);
  cursor: pointer;
  font-weight: 500;
}
.section-divider .action:hover { color: var(--ink); }

.sub-section-title {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--gold-deep);
  margin: var(--sp-6) 0 var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.sub-section-title::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 1px;
  background: var(--gold);
}
.sub-section-title:first-child { margin-top: 0; }

/* ====== PAGE HEADER ====== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: var(--sp-6);
  margin-bottom: var(--sp-8);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: var(--sp-4);
}
.page-header h1 { margin: 0; }
.page-header .eyebrow { margin-bottom: 8px; display: block; }
.page-header-actions {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  flex-wrap: wrap;
}

/* ====== EMPTY STATE ====== */
.empty-state {
  padding: 80px 24px;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
}
.empty-state-glyph {
  font-family: var(--font-serif);
  font-size: 3.5rem;
  font-style: italic;
  color: var(--gold);
  margin-bottom: var(--sp-4);
}
.empty-state h3 {
  margin-bottom: var(--sp-2);
  font-style: italic;
}
.empty-state p {
  color: var(--muted);
  max-width: 400px;
  margin: 0 auto var(--sp-5);
}

/* ====== COMING SOON PLACEHOLDER ====== */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: var(--sp-8);
  text-align: center;
}
.coming-soon-glyph {
  font-family: var(--font-serif);
  font-size: 5rem;
  font-style: italic;
  color: var(--gold);
  opacity: 0.5;
  margin-bottom: var(--sp-5);
}
.coming-soon h2 {
  font-style: italic;
  margin-bottom: var(--sp-3);
}
.coming-soon p {
  color: var(--charcoal);
  max-width: 480px;
  margin: 0 auto var(--sp-5);
  line-height: var(--lh-normal);
}
.coming-soon-tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--gold-pale);
  color: var(--gold-deep);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ====== PRICE / NUMERIC DISPLAY ====== */
.price-value {
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: var(--tracking-tighter);
}
.price-value.gold { color: var(--gold-deep); }
.price-value.lg { font-size: 1.2rem; }
.price-value.xl { font-size: 1.5rem; }
.price-value.hero { font-size: 2.2rem; }

.margin-pill {
  display: inline-block;
  padding: 3px 10px;
  background: var(--emerald-pale);
  color: var(--emerald);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
}
.margin-pill.neg { background: var(--bordeaux-pale); color: var(--bordeaux); }

/* ====== CONFIRM DIALOG ====== */
.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 29, 36, 0.6);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.confirm-overlay.show { display: flex; animation: fadeIn 0.15s; }
.confirm-box {
  background: var(--paper);
  border-top: 3px solid var(--bordeaux);
  max-width: 420px;
  width: 100%;
  padding: var(--sp-7);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-sm);
}
.confirm-box h3 { margin-bottom: var(--sp-3); font-style: italic; }
.confirm-box p { color: var(--charcoal); margin-bottom: var(--sp-6); }
.confirm-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }
/* Polish & Micro-interactions */
.piece-card {
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease, border-color 0.2s;
}
.piece-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 30px rgba(26, 29, 36, 0.08);
  border-color: var(--gold-soft);
}
.table tbody tr {
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.table tbody tr:active {
  transform: scale(0.99);
}
.btn {
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.1);
  opacity: 0; transition: opacity 0.2s;
}
.btn:active::after { opacity: 1; }