/* Clean Steel Industrial SaaS Theme - Commerce Ops Platform */
:root {
  --steel-950: #020617;
  --steel-900: #0f172a;
  --steel-850: #172033;
  --steel-800: #1e293b;
  --steel-700: #334155;
  --steel-600: #475569;
  --steel-500: #64748b;
  --steel-400: #94a3b8;
  --steel-300: #cbd5e1;
  --steel-200: #e2e8f0;
  --steel-100: #f1f5f9;
  --steel-50: #f8fafc;
  --white: #ffffff;
  
  --brand-primary: #0284c7;
  --brand-hover: #0369a1;
  --brand-light: #e0f2fe;

  --status-ok-bg: #ecfdf5;
  --status-ok-text: #065f46;
  --status-ok-border: #a7f3d0;
  
  --status-warn-bg: #fffbeb;
  --status-warn-text: #92400e;
  --status-warn-border: #fde68a;

  --status-alert-bg: #fff1f2;
  --status-alert-text: #9f1239;
  --status-alert-border: #fecdd3;
  
  --fefo-accent: #f59e0b;
  --fefo-bg: #fef3c7;
  --fefo-border: #d97706;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--steel-50);
  color: var(--steel-900);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Watermark & Top Notice Banner */
.top-mockup-banner {
  background: linear-gradient(90deg, #b45309, #d97706, #b45309);
  color: #ffffff;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  z-index: 1000;
  position: sticky;
  top: 0;
}
.banner-badge {
  background: rgba(0,0,0,0.3);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255,255,255,0.3);
}

/* Header & Shell */
.app-header {
  background-color: var(--steel-900);
  color: var(--white);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--steel-800);
  position: sticky;
  top: 31px;
  z-index: 990;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  font-size: 20px;
  background: var(--brand-primary);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.brand-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.3px;
}
.brand-version {
  font-size: 11px;
  background: var(--steel-800);
  color: var(--steel-300);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Tenant Switcher Controls */
.tenant-switcher-box {
  display: flex;
  align-items: center;
  background: var(--steel-800);
  border: 1px solid var(--steel-700);
  border-radius: var(--radius-md);
  padding: 4px 6px;
  gap: 8px;
}
.tenant-label {
  font-size: 12px;
  color: var(--steel-400);
  text-transform: uppercase;
  font-weight: 600;
  padding-left: 4px;
}
.tenant-toggle-btn {
  background: transparent;
  border: none;
  color: var(--steel-300);
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.tenant-toggle-btn.active {
  background: var(--brand-primary);
  color: var(--white);
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.operator-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--steel-300);
}
.operator-avatar {
  width: 28px;
  height: 28px;
  background: var(--steel-700);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* App Body Layout */
.app-container {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 87px);
}

/* Sidebar Navigation */
.app-sidebar {
  width: 240px;
  background: var(--steel-900);
  color: var(--steel-300);
  border-right: 1px solid var(--steel-800);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.tenant-info-card {
  padding: 16px;
  background: var(--steel-850);
  border-bottom: 1px solid var(--steel-800);
}
.tenant-header-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tenant-header-desc {
  font-size: 11px;
  color: var(--steel-400);
  margin-top: 4px;
  line-height: 1.3;
}
.tenant-tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  background: rgba(2, 132, 199, 0.2);
  color: #38bdf8;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.nav-menu {
  list-style: none;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--steel-300);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  cursor: pointer;
}
.nav-link:hover {
  background: var(--steel-800);
  color: var(--white);
}
.nav-link.active {
  background: var(--brand-primary);
  color: var(--white);
  font-weight: 600;
}
.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--steel-700);
  color: var(--steel-200);
  font-weight: 600;
}
.nav-link.active .nav-badge {
  background: rgba(255,255,255,0.25);
  color: var(--white);
}

/* Main Content Area */
.main-viewport {
  flex: 1;
  background: var(--steel-50);
  padding: 24px;
  overflow-y: auto;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* Page Header & Breadcrumbs */
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--steel-900);
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-subtitle {
  font-size: 13px;
  color: var(--steel-500);
  margin-top: 2px;
}
.page-actions {
  display: flex;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-primary {
  background: var(--brand-primary);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--brand-hover);
}
.btn-outline {
  background: var(--white);
  border-color: var(--steel-300);
  color: var(--steel-700);
}
.btn-outline:hover {
  background: var(--steel-100);
  border-color: var(--steel-400);
}
.btn-danger {
  background: #e11d48;
  color: #ffffff;
}
.btn-danger:hover {
  background: #be123c;
}
.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* Operational Alert Strip */
.alert-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  border-left: 4px solid;
  box-shadow: var(--shadow-sm);
  gap: 12px;
}
.alert-item.alert {
  background: var(--status-alert-bg);
  border-color: #e11d48;
  color: var(--status-alert-text);
}
.alert-item.warning {
  background: var(--status-warn-bg);
  border-color: #d97706;
  color: var(--status-warn-text);
}
.alert-item.info {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e40af;
}
.alert-item.success {
  background: var(--status-ok-bg);
  border-color: #059669;
  color: var(--status-ok-text);
}
.alert-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.alert-action-btn {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--white);
  border: 1px solid var(--steel-200);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand-primary);
}
.kpi-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--steel-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--steel-900);
  margin: 6px 0 4px 0;
}
.kpi-delta {
  font-size: 12px;
  color: var(--steel-600);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Card Surface & Tables */
.card {
  background: var(--white);
  border: 1px solid var(--steel-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--steel-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  flex-wrap: wrap;
  gap: 10px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--steel-900);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body {
  padding: 18px;
}

/* Filters & Toolbars */
.filter-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--steel-100);
  border-bottom: 1px solid var(--steel-200);
  flex-wrap: wrap;
}
.filter-input {
  padding: 6px 12px;
  border: 1px solid var(--steel-300);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--white);
  min-width: 220px;
}
.filter-select {
  padding: 6px 10px;
  border: 1px solid var(--steel-300);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--white);
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.data-table th {
  background: var(--steel-100);
  color: var(--steel-700);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--steel-300);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--steel-200);
  vertical-align: middle;
  font-size: 13px;
}
.data-table tbody tr:hover {
  background-color: var(--steel-50);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-ok {
  background: var(--status-ok-bg);
  color: var(--status-ok-text);
  border-color: var(--status-ok-border);
}
.badge-warning {
  background: var(--status-warn-bg);
  color: var(--status-warn-text);
  border-color: var(--status-warn-border);
}
.badge-alert {
  background: var(--status-alert-bg);
  color: var(--status-alert-text);
  border-color: var(--status-alert-border);
}
.badge-fefo {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
  font-weight: 700;
  box-shadow: 0 0 4px rgba(245, 158, 11, 0.4);
}
.badge-rx-blocked {
  background: #881337;
  color: #ffe4e6;
  border: 1px solid #f43f5e;
  font-weight: 700;
  animation: pulse-border 1.8s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(225, 29, 72, 0); }
  100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); }
}

.pill-negative {
  background: #ffe4e6;
  color: #be123c;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 12px;
  border: 1px solid #fda4af;
  display: inline-block;
}

/* Lots Sub-Table (Accordion) */
.lots-accordion-row {
  background: #f8fafc;
}
.lots-accordion-container {
  padding: 10px 18px 14px 44px;
}
.sub-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--steel-200);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.sub-table th {
  background: var(--steel-100);
  padding: 6px 10px;
  font-size: 11px;
  border-bottom: 1px solid var(--steel-200);
}
.sub-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--steel-100);
}
.sub-table tr.highlight-fefo {
  background-color: #fffbeb;
  border-left: 3px solid #f59e0b;
}

/* Drawer / Slide-Over */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}
.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 90vw;
  height: 100vh;
  background: var(--white);
  box-shadow: -4px 0 24px rgba(0,0,0,0.2);
  z-index: 1060;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
.drawer-panel.active {
  transform: translateX(0);
}
.drawer-header {
  padding: 16px 20px;
  background: var(--steel-900);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-title {
  font-size: 16px;
  font-weight: 700;
}
.drawer-close {
  background: transparent;
  border: none;
  color: var(--steel-400);
  font-size: 20px;
  cursor: pointer;
}
.drawer-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}
.drawer-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--steel-200);
  background: var(--steel-50);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 1070;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop.active {
  display: flex;
}
.modal-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-enter 0.2s ease-out;
}
@keyframes modal-enter {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-header {
  padding: 16px 20px;
  background: var(--steel-900);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
}
.modal-body {
  padding: 20px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--steel-200);
  background: var(--steel-50);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Group Buy Progress & Tiers */
.progress-bar-wrap {
  width: 100%;
  height: 10px;
  background: var(--steel-200);
  border-radius: 5px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #10b981);
  transition: width 0.4s ease;
}
.tier-pill-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.tier-pill {
  padding: 8px;
  border: 1px solid var(--steel-200);
  border-radius: var(--radius-sm);
  text-align: center;
  background: var(--steel-50);
}
.tier-pill.unlocked {
  border-color: #059669;
  background: #ecfdf5;
}
.tier-pill.next {
  border-color: #0284c7;
  background: #e0f2fe;
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
  }
  .app-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--steel-800);
  }
  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
  }
  .nav-link {
    white-space: nowrap;
  }
  .main-viewport {
    padding: 14px;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}
