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

body {
  font-family: Poppins, 'Helvetica Neue', Arial, sans-serif;
  background: #ffffff;
  color: #24186d;
  line-height: 1.5;
  font-weight: 600;
}

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #ffffff;
}

.login-card {
  background: #fff;
  border: 2px solid #24186d;
  border-radius: 8px;
  padding: 40px;
  width: 360px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 24px;
  text-align: center;
  color: #24186d;
}

.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(36, 24, 109, 0.25);
  border-radius: 8px;
  font-family: Poppins, sans-serif;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #24186d;
}

.login-card input:focus {
  outline: none;
  border-color: #24186d;
}

.login-card button {
  width: 100%;
  padding: 13px 20px;
  background: #24186d;
  color: #fff;
  border: 0;
  border-radius: 50px;
  font-family: Poppins, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 200ms cubic-bezier(0.2, 0.3, 0.25, 0.9);
}

.login-card button:hover { background: #1a1050; }

.error { color: #a9114a; font-size: 13px; margin-top: 12px; text-align: center; }
.success { color: #00730B; font-size: 13px; margin-top: 12px; text-align: center; }

/* App layout */
.app-header {
  background: #fff;
  border-bottom: 2px solid rgba(36, 24, 109, 0.1);
  padding: 14px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-header h1 {
  font-size: 18px;
  font-weight: 600;
  color: #24186d;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-user {
  font-size: 14px;
  font-weight: 600;
}

.app-header a {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #24186d;
  text-decoration: none;
}

.app-header a:hover { text-decoration: underline; }

.btn-link {
  background: none;
  border: none;
  color: #24186d;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  letter-spacing: 0;
  font-family: Poppins, sans-serif;
}

.btn-link:hover { color: #24186d; }

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

@media (max-width: 960px) {
  .container { padding: 0 25px; }
  .app-header { padding: 14px 25px; }
}

@media (max-width: 620px) {
  .container { padding: 0 15px; }
  .app-header { padding: 14px 15px; }
}

/* Cards */
.card {
  background: #fff;
  border: 1px solid rgba(36, 24, 109, 0.15);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #24186d;
}

.card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Forms */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 6px;
  color: #24186d;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
select {
  padding: 10px 10px 9px;
  border: 1px solid rgba(36, 24, 109, 0.25);
  border-radius: 8px;
  font-family: Poppins, sans-serif;
  font-size: 14px;
  font-weight: 600;
  width: 100%;
  color: #24186d;
  background: #fff;
}

input:focus, select:focus {
  outline: none;
  border-color: #24186d;
  box-shadow: none;
}

.help-text {
  font-style: italic;
  font-size: 13px;
  font-weight: 600;
  color: #24186d;
  margin-top: 2px;
}

.type-select {
  min-width: 200px;
}

.field { margin-bottom: 0; }

/* Buttons */
.btn {
  padding: 10px 20px;
  border: 2px solid #24186d;
  border-radius: 50px;
  font-family: Poppins, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  background: #fff;
  color: #24186d;
  transition: all 200ms cubic-bezier(0.2, 0.3, 0.25, 0.9);
  display: inline-block;
  text-align: center;
}

.btn:hover {
  color: #24186d;
  border-color: #24186d;
}

.btn-primary {
  background: #24186d;
  color: #fff;
  border-color: #24186d;
}

.btn-primary:hover {
  background: #1a1050;
  border-color: #1a1050;
  color: #fff;
}

.btn-danger {
  color: #a9114a;
  border-color: transparent;
  background: none;
  padding: 4px 8px;
  font-size: 11px;
}

.btn-danger:hover { background: #fedeed; border-radius: 50px; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Banners */
.banner {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}

.banner-info { background: #fff; border: 1px solid rgba(36, 24, 109, 0.15); }
.banner-success { background: #e3f9e5; border: 1px solid #a6e9ad; color: #00730B; }
.banner-error { background: #fef2f2; border: 1px solid #f9c4c4; color: #DD2200; }

.banner h4 {
  font-weight: 600;
  margin-bottom: 8px;
}

/* Slot card (rule groups) */
.slot-card {
  background: #fff;
  border: 1px solid rgba(36, 24, 109, 0.15);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: #fedeed;
  color: #a9114a;
}

/* Rule products */
.rule-products {
  margin-bottom: 12px;
}

.rule-product-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(36, 24, 109, 0.1);
}

.rule-product-item:last-child { border-bottom: none; }

.result-title {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}

.rule-add-product {
  margin-top: 8px;
}

.fallback-num {
  font-size: 12px;
  font-weight: 600;
  color: #24186d;
  min-width: 20px;
}

/* Product picker dropdown */
.product-picker {
  position: relative;
}

.product-dropdown {
  position: absolute;
  z-index: 100;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(36, 24, 109, 0.15);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(36, 24, 109, 0.08);
  margin-top: 2px;
}

.product-item {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 1px solid rgba(36, 24, 109, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-item:hover { background: rgba(36, 24, 109, 0.02); }
.product-item:last-child { border-bottom: none; }

.search-item-img {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(36, 24, 109, 0.1);
}

.search-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-item-no-img {
  background: rgba(36, 24, 109, 0.04);
}

.product-type-tag {
  color: #24186d;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.no-results {
  padding: 12px 10px;
  color: #24186d;
  font-style: italic;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

/* Tabs */
.app-tabs {
  display: flex;
  background: #fff;
  border-bottom: 2px solid rgba(36, 24, 109, 0.1);
  padding: 0 30px;
}

@media (max-width: 960px) {
  .app-tabs { padding: 0 25px; }
}

@media (max-width: 620px) {
  .app-tabs { padding: 0 15px; }
}

.app-tab {
  padding: 12px 20px;
  border: none;
  background: none;
  font-family: Poppins, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #24186d;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 200ms cubic-bezier(0.2, 0.3, 0.25, 0.9);
}

.app-tab:hover { color: #24186d; }
.app-tab.active { color: #24186d; border-bottom-color: #24186d; }

/* Bundle list */
.bundle-list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(36, 24, 109, 0.1);
  cursor: pointer;
  transition: background 150ms ease;
}

.bundle-list-item:last-child { border-bottom: none; }
.bundle-list-item:hover { background: rgba(36, 24, 109, 0.02); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 8px; }

.bundle-list-image {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(36, 24, 109, 0.1);
}

.bundle-list-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bundle-list-no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  color: #24186d;
  background: rgba(36, 24, 109, 0.04);
}

.bundle-list-info {
  flex: 1;
  min-width: 0;
}

.bundle-list-title {
  font-size: 14px;
  font-weight: 600;
  color: #24186d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bundle-list-meta {
  font-size: 12px;
  font-weight: 600;
  color: #24186d;
  margin-top: 2px;
}

.bundle-list-arrow {
  font-size: 20px;
  color: #24186d;
  flex-shrink: 0;
}

/* Bundle styles */
.bundle-card { position: relative; }

.bundle-parent-picker { margin-bottom: 12px; }
.bundle-parent-picker label { margin-bottom: 6px; }

.variant-mapping {
  background: #f7f6fb;
  border: 1px solid rgba(36, 24, 109, 0.15);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 10px;
}

.variant-mapping-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(36, 24, 109, 0.1);
}

.component-list { margin-bottom: 8px; }

.component-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(36, 24, 109, 0.06);
  font-size: 13px;
}

.component-item:last-child { border-bottom: none; }

.component-image {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(36, 24, 109, 0.1);
}

.component-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.component-info {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.sku-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 50px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: rgba(36, 24, 109, 0.08);
  color: #24186d;
  margin-left: 4px;
}

.add-component { margin-top: 8px; }

/* Quantity input */
.qty-input {
  width: 48px !important;
  display: inline-block;
  padding: 2px 4px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(36, 24, 109, 0.25);
  border-radius: 8px;
  font-family: Poppins, sans-serif;
}

.price-tag {
  font-size: 12px;
  font-weight: 600;
  color: #24186d;
  margin-left: 4px;
}

/* Bundle pricing summary */
.bundle-pricing {
  background: #fff;
  border: 1px solid rgba(36, 24, 109, 0.15);
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  margin-bottom: 8px;
}

.pricing-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}

.pricing-row label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  margin-bottom: 0;
}

.total-value {
  font-weight: 600;
}

.price-input-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
}

.price-prefix {
  font-weight: 600;
  font-size: 14px;
}

.price-input {
  width: 100px !important;
  padding: 4px 8px !important;
  font-size: 14px !important;
  font-weight: 600;
  text-align: right;
}

.pricing-row.savings {
  color: #00730B;
  font-weight: 600;
  border-top: 1px solid rgba(36, 24, 109, 0.15);
  margin-top: 4px;
  padding-top: 8px;
}

.add-variant-select {
  margin-top: 0;
}

/* Slot fields grid (used in admin form) */
.slot-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 500px) {
  .slot-fields {
    grid-template-columns: 1fr 1fr;
  }
  .slot-fields .field:first-child {
    grid-column: 1 / -1;
  }
}

/* Admin — User rows */
.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(36, 24, 109, 0.1);
}

.admin-user-row:last-child { border-bottom: none; }

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-user-name {
  font-size: 15px;
  font-weight: 600;
}

.admin-user-email {
  font-size: 13px;
  font-weight: 600;
  color: #24186d;
}

.admin-user-actions {
  display: flex;
  gap: 6px;
}

.admin-user-perms {
  font-size: 12px;
  font-weight: 600;
  color: #24186d;
}

/* Admin — Activity log */
.admin-activity-list {
  max-height: 400px;
  overflow-y: auto;
}

.admin-activity-row {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(36, 24, 109, 0.1);
  font-size: 13px;
  align-items: baseline;
}

.admin-activity-row:last-child { border-bottom: none; }

.admin-activity-time {
  font-family: Poppins, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #24186d;
  min-width: 120px;
  flex-shrink: 0;
}

.admin-activity-user {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  min-width: 80px;
  flex-shrink: 0;
}

.admin-activity-action {
  font-size: 13px;
  font-weight: 600;
}

.admin-activity-details {
  font-style: italic;
  font-size: 13px;
  font-weight: 600;
  color: #24186d;
}

/* Badges */
.badge-danger { background: #fedeed; color: #a9114a; }
.badge-info { background: rgba(36, 24, 109, 0.08); color: #24186d; }
.badge-success { background: #e3f9e5; color: #00730B; }

/* Permissions grid */
.permissions-grid {
  margin-top: 12px;
  border: 1px solid rgba(36, 24, 109, 0.15);
  border-radius: 8px;
  overflow: hidden;
}

.permissions-header,
.permissions-row {
  display: grid;
  grid-template-columns: 1fr 60px 60px 60px;
  align-items: center;
  padding: 8px 12px;
}

.permissions-header {
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.permissions-row {
  border-top: 1px solid rgba(36, 24, 109, 0.1);
}

.permissions-row .permissions-label {
  font-size: 14px;
  font-weight: 600;
}

.permissions-option {
  text-align: center;
}

.permissions-row label {
  text-align: center;
  cursor: pointer;
}

/* Dashboard — KPI Grid */
.dash-kpi-group h3 {
  margin-bottom: 12px;
}

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.dash-kpi-card {
  background: #f7f6fb;
  border: 1px solid rgba(36, 24, 109, 0.15);
  border-radius: 8px;
  padding: 14px 16px;
}

.dash-kpi-label {
  font-family: Poppins, 'Helvetica Neue', Arial, sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(36, 24, 109, 0.6);
  margin-bottom: 6px;
}

.dash-kpi-value {
  font-family: Poppins, 'Helvetica Neue', Arial, sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: #24186d;
  margin-bottom: 4px;
}

.dash-change-up {
  font-family: Poppins, 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #00730B;
}

.dash-change-down {
  font-family: Poppins, 'Helvetica Neue', Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #a9114a;
}

/* Hidden */
.hidden { display: none; }
