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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  font-size: 13px;
}

.header {
  background: linear-gradient(135deg, #ee4d2d, #ff6633);
  color: white;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header h1 { font-size: 20px; font-weight: 600; }
.header .subtitle { font-size: 12px; opacity: 0.85; }
.header .disclaimer { font-size: 10px; opacity: 0.65; font-style: italic; margin-top: 2px; }

.controls {
  background: white;
  padding: 16px 24px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.controls label { font-weight: 600; font-size: 12px; color: #555; }
.controls input[type="text"],
.controls select {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.controls input[type="text"]:focus,
.controls select:focus { border-color: #ee4d2d; }

.controls input[type="text"] { width: 220px; }

.toggle-group {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 0;
}

.toggle-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-weight: 500;
  font-size: 12px;
}

.toggle-group input[type="checkbox"] {
  accent-color: #ee4d2d;
  width: 15px;
  height: 15px;
}

.margin-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.margin-filter input[type="range"] {
  width: 100px;
  accent-color: #ee4d2d;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  padding: 16px 24px;
}

.stat-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.stat-card .label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-card .value {
  font-size: 22px;
  font-weight: 700;
}

.stat-card .value.green { color: #27ae60; }
.stat-card .value.red { color: #e74c3c; }
.stat-card .value.orange { color: #f39c12; }
.stat-card .value.blue { color: #2980b9; }

.table-container {
  padding: 0 24px 24px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  font-size: 12px;
}

thead {
  background: #2c3e50;
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  padding: 10px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th:hover { background: #34495e; }
th .sort-arrow { margin-left: 3px; font-size: 9px; }

/* Group label row */
.group-row th {
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.5px;
  padding: 6px 8px;
  cursor: default;
  border-bottom: 2px solid rgba(255,255,255,0.2);
}
.group-row .group-header.info-group,
.group-row .group-header.info-group:hover { background: #2c3e50; }
.group-row .group-header.sale-group,
.group-row .group-header.sale-group:hover { background: #0097a7; }
.group-row .group-header.mall-group,
.group-row .group-header.mall-group:hover { background: #c0392b; }
.group-row .group-header.mp-group,
.group-row .group-header.mp-group:hover { background: #e67e22; }
.group-row .group-header.target-group,
.group-row .group-header.target-group:hover { background: #27ae60; }

/* Column header colors */
th.info-header { background: #34495e; }
th.info-header:hover { background: #3d566e; }
th.mall-header { background: #c0392b; }
th.mall-header:hover { background: #d44637; }
th.mp-header { background: #e67e22; }
th.mp-header:hover { background: #f39c12; }
th.sale-header { background: #0097a7; }
th.sale-header:hover { background: #00acc1; }
th.target-header { background: #27ae60; }
th.target-header:hover { background: #2ecc71; }

td {
  padding: 8px;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}

tr:hover { background: #fef5f0; }

.text-right { text-align: right; }
.comm-rate { color: #888; font-size: 11px; }

.margin-cell {
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-align: right;
  display: inline-block;
  min-width: 55px;
}

.margin-good { background: #d4edda; color: #155724; }
.margin-ok { background: #fff3cd; color: #856404; }
.margin-bad { background: #f8d7da; color: #721c24; }
.margin-negative { background: #721c24; color: white; }

.no-cpu { color: #aaa; font-style: italic; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  font-size: 18px;
  color: #888;
}

.loading .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f0f0f0;
  border-top: 4px solid #ee4d2d;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
}

.pagination button {
  padding: 6px 14px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.pagination button:hover { background: #fef5f0; border-color: #ee4d2d; }
.pagination button:disabled { opacity: 0.4; cursor: default; }
.pagination button.active { background: #ee4d2d; color: white; border-color: #ee4d2d; }
.pagination .info { font-size: 12px; color: #666; }

.category-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: #eef2ff;
  color: #4338ca;
}

.fee-detail { font-size: 10px; color: #999; }

/* Quick Margin Calculator */
.quick-calc {
  margin: 12px 24px 0;
  background: white;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}

.quick-calc summary {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  color: #ee4d2d;
  user-select: none;
}

.quick-calc summary:hover { background: #fef5f0; }

.calc-body {
  padding: 0 16px 16px;
}

.calc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.calc-row > div { flex: 1; min-width: 150px; }
.calc-row > .calc-toggles { flex: 0 0 auto; min-width: auto; display: flex; flex-direction: column; gap: 4px; justify-content: flex-end; }
.calc-toggles label { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: #555; cursor: pointer; white-space: nowrap; margin-bottom: 0; }
.calc-toggles input[type="checkbox"] { width: auto; margin: 0; }

.calc-row label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}

.calc-row input,
.calc-row select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}

.calc-row input:focus,
.calc-row select:focus { border-color: #ee4d2d; }

#calc-btn {
  width: 100%;
  padding: 8px 20px;
  background: #ee4d2d;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#calc-btn:hover { background: #d94425; }

.calc-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.calc-result-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 14px;
  border: 1px solid #e9ecef;
}

.calc-result-card h3 {
  font-size: 14px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #dee2e6;
}

.calc-result-card:first-child h3 { color: #c0392b; border-color: #c0392b; }
.calc-result-card:last-child h3 { color: #e67e22; border-color: #e67e22; }

.calc-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  font-size: 12px;
}

.calc-grid .total-row {
  font-weight: 700;
  padding-top: 4px;
  border-top: 1px solid #dee2e6;
  margin-top: 2px;
}

/* Inline cost editing */
.cost-cell {
  position: relative;
  min-width: 100px;
}

.cost-cell .cost-input {
  width: 80px;
  padding: 3px 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 11px;
  text-align: right;
  outline: none;
  background: #fafafa;
}

.cost-cell .cost-input:focus {
  border-color: #ee4d2d;
  background: white;
  box-shadow: 0 0 0 2px rgba(238, 77, 45, 0.15);
}

.cost-cell .cost-input::placeholder {
  color: #bbb;
  font-style: italic;
}

.cost-override {
  display: block;
  font-size: 10px;
  color: #ee4d2d;
  font-weight: 600;
  margin-top: 2px;
}

/* SRP inline editing */
.srp-cell {
  position: relative;
  min-width: 100px;
}

.srp-cell .srp-input {
  width: 80px;
  padding: 3px 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 11px;
  text-align: right;
  outline: none;
  background: #fafafa;
}

.srp-cell .srp-input:focus {
  border-color: #ee4d2d;
  background: white;
  box-shadow: 0 0 0 2px rgba(238, 77, 45, 0.15);
}

.srp-cell .srp-input::placeholder {
  color: #bbb;
  font-style: italic;
}

.srp-override {
  display: block;
  font-size: 10px;
  color: #ee4d2d;
  font-weight: 600;
  margin-top: 2px;
}

/* Hide spinners on SRP inputs */
.srp-input::-webkit-outer-spin-button,
.srp-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.srp-input[type="number"] {
  -moz-appearance: textfield;
}

/* Hide the number spinner on cost inputs */
.cost-input::-webkit-outer-spin-button,
.cost-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cost-input[type="number"] {
  -moz-appearance: textfield;
}

/* Upload Section */
.upload-section { padding: 12px 24px 0; }

.upload-zone {
  border: 2px dashed #ccc;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone.drag-over { border-color: #ee4d2d; background: #fef5f0; }
.upload-zone:hover { border-color: #999; }
.upload-icon { font-size: 28px; margin-bottom: 4px; }
.upload-zone p { margin: 4px 0; }
.upload-hint { font-size: 12px; color: #888; }
.upload-link { color: #ee4d2d; cursor: pointer; text-decoration: underline; font-weight: 600; }
.upload-formats { font-size: 11px; color: #aaa; }
.template-link { color: #2980b9; text-decoration: underline; }
.template-link:hover { color: #1a5276; }

.upload-status { padding: 10px; text-align: center; font-size: 13px; }
.upload-success { color: #27ae60; font-weight: 600; }
.upload-error { color: #e74c3c; font-weight: 600; }

/* Classification Banner */
.classification-banner {
  margin: 8px 24px;
  padding: 10px 16px;
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 8px;
  font-size: 13px;
  color: #155724;
  display: flex;
  align-items: center;
  gap: 8px;
}

.classification-icon { font-size: 16px; }

.suggested-srp {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: #ee4d2d !important;
}

/* Export Buttons */
.export-actions {
  padding: 0 24px 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.export-btn {
  padding: 7px 16px;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.export-btn:hover { background: #229954; }

/* Column Toggle Dropdown */
.col-toggle-wrapper { position: relative; }
.col-toggle-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 8px 0;
  min-width: 200px;
  margin-top: 4px;
}
.col-toggle-dropdown label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.col-toggle-dropdown label:hover { background: #f5f5f5; }
.col-toggle-dropdown input[type="checkbox"] {
  accent-color: #ee4d2d;
  width: 14px;
  height: 14px;
}
.col-toggle-dropdown hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 4px 0;
}
.export-btn.secondary { background: #6c757d; }
.export-btn.secondary:hover { background: #5a6268; }
.export-hint { font-size: 11px; color: #888; }

/* Sale Price & Discount cells */
.sale-cell, .disc-cell {
  position: relative;
  min-width: 90px;
}

.sale-input, .disc-input {
  width: 75px;
  padding: 3px 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 11px;
  text-align: right;
  outline: none;
  background: #fafafa;
}

.sale-input:focus, .disc-input:focus {
  border-color: #0097a7;
  background: white;
  box-shadow: 0 0 0 2px rgba(0, 151, 167, 0.15);
}

.sale-input::placeholder, .disc-input::placeholder {
  color: #bbb;
  font-style: italic;
}

.sale-active {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #0097a7;
  margin-top: 2px;
}

.disc-active {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #0097a7;
  margin-top: 2px;
}

/* Hide spinners on sale/disc inputs */
.sale-input::-webkit-outer-spin-button,
.sale-input::-webkit-inner-spin-button,
.disc-input::-webkit-outer-spin-button,
.disc-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.sale-input[type="number"],
.disc-input[type="number"] {
  -moz-appearance: textfield;
}

/* Target SRP cells */
.target-cell {
  font-weight: 700;
  color: #27ae60;
}

/* ===== SEO FOOTER ===== */
.seo-footer {
  background: #1a1a2e;
  color: #ccc;
  margin-top: 48px;
  padding: 0;
  font-size: 13px;
  line-height: 1.7;
}

.seo-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 32px;
}

.seo-footer h2 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.seo-footer h3 {
  font-size: 14px;
  font-weight: 600;
  color: #ee4d2d;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.seo-footer p {
  margin-bottom: 10px;
  color: #aab;
}

.seo-footer ul {
  list-style: none;
  padding: 0;
}

.seo-footer ul li {
  padding: 3px 0;
  color: #aab;
}

.seo-footer ul li strong {
  color: #ddd;
}

.seo-footer-faq details {
  margin-bottom: 8px;
  border-bottom: 1px solid #2a2a3e;
  padding-bottom: 8px;
}

.seo-footer-faq summary {
  cursor: pointer;
  color: #ddd;
  font-weight: 500;
  padding: 4px 0;
  font-size: 12.5px;
}

.seo-footer-faq summary:hover {
  color: #ee4d2d;
}

.seo-footer-faq details p {
  font-size: 12px;
  color: #999;
  margin: 6px 0 2px 0;
  padding-left: 12px;
  border-left: 2px solid #333;
}

.seo-footer-bottom {
  border-top: 1px solid #2a2a3e;
  text-align: center;
  padding: 16px 24px;
  font-size: 12px;
  color: #666;
}

.seo-footer-bottom .footer-link {
  color: #888;
  text-decoration: none;
}
.seo-footer-bottom .footer-link:hover {
  color: #ee4d2d;
  text-decoration: underline;
}
