:root {
  --navy: #0B1F3B;
  --accent: #5a7abf;
  --border: #e5e7eb;
  --text-muted: #6b7280;
  --surface: #f8f9fb;
  --danger: #dc2626;
  --success: #16a34a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--surface);
  color: var(--navy);
}

.navbar {
  background: var(--navy);
  padding: 0 20px;
}

.navbar-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.navbar-title {
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.navbar-links {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-btn {
  background: transparent;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.nav-btn:hover, .nav-btn.active {
  background: var(--accent);
}

.save-status {
  color: #9fe1cb;
  font-size: 12px;
  font-weight: 600;
}

.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  color: var(--navy);
}

h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: var(--navy);
}

h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--navy);
}

p.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 4px 0 0;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

.btn {
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--navy);
}

.btn:hover {
  background: var(--surface);
}

.btn-primary {
  background: var(--navy);
  color: #fff;
  border: none;
}

.btn-primary:hover {
  background: #16335c;
}

.btn-danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

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

input, select, textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

label.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

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

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

@media (max-width: 700px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

.list-row-title {
  font-weight: 600;
  font-size: 14px;
}

.list-row-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.design-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 12px;
}

.design-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.design-card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.design-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
}

.design-badge {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 6px;
}

.design-card-body {
  margin-top: 16px;
}

.location-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.location-card-inner {
  flex: 1;
  min-width: 240px;
}

.location-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.location-label {
  font-size: 13px;
  color: var(--text-muted);
  width: 160px;
}

.color-input {
  width: 80px;
}

.image-upload-box {
  justify-content: center;
  padding: 12px 16px;
  font-size: 12px;
  white-space: nowrap;
}

.location-image-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.location-image-preview {
  display: block;
  max-width: 140px;
  max-height: 100px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  margin-bottom: 8px;
  cursor: zoom-in;
}

.location-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.location-info-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px 10px 10px;
  background: #fff;
}

.location-info-thumb {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: zoom-in;
}

.location-info-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
}

.location-info-detail {
  font-size: 12px;
  color: var(--text-muted);
}

.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 31, 59, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: zoom-out;
  padding: 40px;
}

.lightbox-overlay img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.product-group {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.product-group-header {
  background: var(--navy);
  color: #fff;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-group-header.ungrouped {
  background: #9ca3af;
}

.product-group-body {
  padding: 12px;
}

.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 8px;
}

.product-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}

.product-card-fields {
  display: flex;
  gap: 12px;
  flex: 1;
  flex-wrap: wrap;
}

.field-group {
  min-width: 160px;
}

.field-group.product-id {
  min-width: 180px;
}

.product-id-row {
  display: flex;
  gap: 6px;
}

.product-id-row input {
  flex: 1;
}

.error-box {
  background: #fef3f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #b91c1c;
  margin-bottom: 12px;
}

.size-toggle-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.size-toggle {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.size-toggle.selected {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.size-toggle.accent-selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.search-results-dropdown {
  display: none;
  position: relative;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  max-height: 240px;
  overflow-y: auto;
  z-index: 10;
}

.search-results-dropdown.visible {
  display: block;
}

.search-result-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  background: #fff;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  cursor: pointer;
  font-family: inherit;
}

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

.search-result-item:hover {
  background: var(--surface);
}

.search-result-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

.search-result-code {
  font-size: 11px;
  color: var(--text-muted);
}

.search-result-empty {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-muted);
}

table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}

.table-scroll {
  overflow-x: auto;
}

.table-scroll table {
  min-width: 700px;
}

.sticky-col {
  position: sticky;
  left: 0;
  background: #fff;
}

.cell-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  width: 80px;
  font-family: inherit;
}

.price-cell {
  text-align: center;
  font-weight: 600;
  color: var(--navy);
}

.help-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  margin-bottom: 0;
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.share-code-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.share-code {
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  color: var(--navy);
  font-family: monospace;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 700px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric-card {
  background: var(--surface);
  border-radius: 10px;
  padding: 16px;
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
}

.text-right {
  text-align: right;
}

.profit-positive {
  color: var(--success);
  font-weight: 600;
}

.profit-negative {
  color: var(--danger);
  font-weight: 600;
}

.commission-value {
  color: var(--accent);
  font-weight: 600;
}

.center-page {
  max-width: 480px;
  margin: 60px auto;
  text-align: center;
}

.icon {
  display: inline-block;
  vertical-align: middle;
}

.loading-text {
  font-size: 13px;
  color: var(--text-muted);
}

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

.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }

.product-link {
  color: var(--navy);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
}

.product-link:hover {
  color: var(--accent);
}