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

:root {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-secondary: #6b7280;
  --accent: #111827;
  --accent-hover: #374151;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --green: #059669;
  --green-bg: #ecfdf5;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --yellow: #d97706;
  --yellow-bg: #fffbeb;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
}

html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}

/* --- Login --- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 24px;
  text-align: center;
}

.login-card .lang-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--surface);
  color: var(--text);
}

.btn:hover { background: #f3f4f6; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.btn-blue {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-blue:hover { opacity: 0.9; }

.btn-green {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.btn-green:hover { background: var(--green); opacity: 1; }

.btn-red {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-red:hover { background: var(--red); opacity: 1; }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-full { width: 100%; }

.lang-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
}
.lang-btn:hover { background: #f3f4f6; }

.error-msg {
  color: var(--red);
  font-size: 0.85rem;
  margin-bottom: 12px;
  text-align: center;
  display: none;
}
.error-msg.visible { display: block; }

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-title {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

.header-nav {
  display: flex;
  gap: 4px;
}

.nav-btn {
  padding: 6px 16px;
  border: none;
  background: none;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.nav-btn:hover { background: #f3f4f6; color: var(--text); }
.nav-btn.active { background: var(--accent); color: #fff; }

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

.user-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* --- Main Content --- */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}

/* --- Search --- */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.search-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
}
.search-bar input:focus { outline: none; border-color: var(--accent); }

.search-results {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.search-card-wrapper {
  margin-bottom: 10px;
}

.search-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search-card img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #f3f4f6;
  flex-shrink: 0;
}

.search-card-info {
  flex: 1;
  min-width: 0;
}

.search-card-title {
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-card-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.search-card .btn { flex-shrink: 0; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- Quotation List --- */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 6px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.filter-tab:hover { background: #f3f4f6; }
.filter-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.q-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s;
  margin-bottom: 8px;
}
.q-card:hover { border-color: var(--accent); }

.q-card img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #f3f4f6;
  flex-shrink: 0;
}

.q-card-info { flex: 1; min-width: 0; }

.q-card-title {
  font-weight: 600;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.q-card-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.q-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-pending { background: var(--yellow-bg); color: var(--yellow); }
.badge-approved { background: var(--green-bg); color: var(--green); }
.badge-rejected { background: var(--red-bg); color: var(--red); }

.q-card-date {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* --- Quotation Detail Form --- */
.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-header img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius);
  background: #f3f4f6;
  flex-shrink: 0;
}

.detail-header-info { flex: 1; }
.detail-header-info h2 { font-size: 1.1rem; font-weight: 600; }
.detail-header-info p { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

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

.toggle-label {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #d1d5db;
  border-radius: 24px;
  transition: 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Image upload area */
.image-upload-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.image-upload-box {
  flex: 1;
  min-width: 200px;
}

.image-upload-label {
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.image-preview {
  width: 100%;
  aspect-ratio: 4/3;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fafafa;
  position: relative;
  cursor: pointer;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-preview-empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 10px;
}

.image-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

/* Pricing grid */
.price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.price-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.price-field input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
}
.price-field input:focus { outline: none; border-color: var(--accent); }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.form-actions .btn { flex: 1; min-width: 120px; }

.save-status {
  font-size: 0.8rem;
  color: var(--green);
  margin-top: 6px;
  min-height: 20px;
}

.admin-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.review-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 10px;
}

.btn-delete-sm {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 4px 8px;
}
.btn-delete-sm:hover { text-decoration: underline; }

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--accent);
  color: #fff;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  transition: transform 0.3s ease;
  z-index: 1000;
  pointer-events: none;
}
.toast.visible { transform: translateX(-50%) translateY(0); }

/* --- Dropdown Form (inline under search card) --- */
.dropdown-form {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-top: -1px;
}

.dropdown-inner {
  padding: 18px 20px;
}

.dropdown-row-fields {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
}

.compact-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compact-field label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.compact-field .cell-input {
  width: 76px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  text-align: right;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.compact-field .cell-input:hover { border-color: #c0c4cc; }
.compact-field .cell-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(17,24,39,0.08); background: #fff; }
.compact-field .cell-input:disabled { opacity: 0.5; cursor: not-allowed; background: #f3f4f6; }
.compact-field .cell-input::placeholder { color: #c0c4cc; }

.compact-field .cell-select,
.cell-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  min-width: 90px;
  transition: border-color 0.15s;
}
.cell-select:hover { border-color: #c0c4cc; }
.cell-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(17,24,39,0.08); }

/* Locked cost cell (already quoted) */
.cell-locked {
  display: inline-block;
  padding: 7px 8px;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Empty editable cost input highlight */
.cell-input-empty {
  background: #fef2f2 !important;
  border-style: dashed !important;
  border-color: #dc2626 !important;
}

.save-indicator {
  justify-content: flex-end;
  align-self: center;
  min-width: 24px;
}
.save-indicator span { font-size: 14px; color: var(--green); font-weight: 600; }

/* Sizes multi-select dropdown */
.sizes-dropdown { position: relative; }

.sizes-btn {
  text-align: left;
  min-width: 100px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px !important;
}

.sizes-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  padding: 10px 12px;
  z-index: 50;
  width: 200px;
}
.sizes-panel.open {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

.size-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 6px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text);
  transition: background 0.1s;
}
.size-check:hover { background: #f3f4f6; }
.size-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Media row (factory img, size chart, notes) */
.dropdown-row-media {
  display: flex;
  gap: 14px;
}

.media-box {
  flex: 1;
  min-width: 0;
}

.media-box > label:first-child {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.media-thumb {
  position: relative;
  width: 100%;
  height: 110px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s;
}
.media-thumb:hover { border-color: #c0c4cc; }

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.media-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.media-thumb:hover .media-remove { opacity: 1; }
.media-remove:hover { background: var(--red); }

.media-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 110px;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px !important;
  font-weight: 500 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  transition: border-color 0.15s, color 0.15s;
}
.media-empty:hover { border-color: var(--accent); color: var(--accent); }
.media-empty.drag-over, .media-thumb.drag-over { border: 2px solid var(--blue); background: var(--blue-bg); }

.media-upload-btn {
  margin-top: 6px;
  cursor: pointer;
  display: inline-flex;
  font-size: 11px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.media-notes {
  width: 100%;
  height: 110px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  font-family: inherit;
  resize: none;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.media-notes:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(17,24,39,0.08); }
.media-notes::placeholder { color: #c0c4cc; }

.dropdown-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.dropdown-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.save-status-text {
  font-size: 12px;
  color: var(--green);
  font-weight: 500;
}

.dropdown-admin {
  display: flex;
  gap: 8px;
}

/* Badge for similar stock style */
.badge-similar { background: var(--yellow-bg); color: var(--yellow); }

/* --- Lightbox --- */
.lightbox {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lightbox.open { display: flex; }

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  border: none;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.lightbox-close:hover { background: #f3f4f6; }

/* --- Products Table (matches dashboard style) --- */
.table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: calc(100vh - 140px);
}

.sp-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.sp-table thead {
  background: #f9fafb;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.sp-table th {
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
  background: #f9fafb;
  border-right: 1px solid var(--border);
}
.sp-table th:first-child { text-align: left; }
.sp-table th:last-child { border-right: none; }

.sp-table td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid #f3f4f6;
  border-right: 1px solid #f3f4f6;
  vertical-align: middle;
  text-align: center;
}
.sp-table td:first-child { text-align: left; }
.sp-table td:last-child { border-right: none; }

.sp-table tbody tr { transition: background 0.15s; }
.sp-table tbody tr:hover { background: #F9FAFB; }
.sp-table tbody tr:last-child td { border-bottom: none; }

.clickable-row { cursor: pointer; }

/* Product cell */
.product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
  max-width: 240px;
}

.product-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #f3f4f6;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  object-fit: cover;
}

.product-info { min-width: 0; }

.product-name {
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
}

.product-variant {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

/* Product link */
.product-link {
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}
.product-link:hover { color: var(--accent); text-decoration: underline; }

/* Inline badges */
.badge-inline {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-yes { background: var(--green-bg); color: var(--green); }
.badge-no { background: var(--red-bg); color: var(--red); }

.text-muted { color: #d1d5db; }

/* Money display */
.money {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -0.2px;
}

/* Inline editable cells */
.cell-input {
  width: 70px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
  text-align: right;
  transition: border-color 0.15s;
  font-variant-numeric: tabular-nums;
}
.cell-input:hover { border-color: var(--border); }
.cell-input:focus { outline: none; border-color: var(--accent); background: #fff; }
.cell-input:disabled { opacity: 0.5; cursor: not-allowed; }
.cell-notes { width: 130px; text-align: left; }

.cell-check {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
  cursor: pointer;
}

.td-center { text-align: center; }

.edit-row { cursor: pointer; }
.edit-row.row-selected { background: #eff6ff; }
.edit-row.row-selected:hover { background: #e0ecff; }

.row-save-status {
  font-size: 12px;
  color: var(--green);
  font-weight: 600;
}

.td-save { width: 28px; text-align: center; }

.td-date {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* --- Controls Row (products page) --- */
.controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.country-tabs {
  display: flex;
  gap: 3px;
}

.country-tab {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
}
.country-tab:hover { background: #f3f4f6; color: var(--text); }
.country-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.sort-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.sort-select:focus { outline: none; border-color: var(--accent); }

.product-search {
  margin-left: auto;
}
.product-search input {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  width: 180px;
}
.product-search input:focus { outline: none; border-color: var(--accent); }

/* --- Product tag --- */
.product-tag {
  display: inline-flex;
  font-size: 11px;
  color: var(--green);
  font-weight: 500;
  margin-top: 1px;
}

/* --- Orders badge --- */
.orders-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  background: #f3f4f6;
  color: var(--text);
}
.orders-badge.high { background: var(--blue-bg); color: var(--blue); }

/* --- COGS badge --- */
.cogs-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
}
.cogs-badge.good { background: var(--green-bg); color: var(--green); }
.cogs-badge.warning { background: var(--yellow-bg); color: var(--yellow); }
.cogs-badge.bad { background: var(--red-bg); color: var(--red); }

/* --- Cost breakdown --- */
.cost-breakdown {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.cost-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.cost-item .cost-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #9ca3af;
  font-weight: 500;
}

.cost-item .cost-val {
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* --- OOS badge + row --- */
.oos-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: var(--red-bg);
  color: var(--red);
  margin-left: 6px;
}

.row-oos td { opacity: 0.4; }
.row-oos td:first-child { opacity: 0.5; }
.row-oos:hover { background: transparent !important; }

/* Inline cost input for empty cells */
.inline-cost-input {
  width: 100%;
  max-width: 68px;
  padding: 5px 7px;
  border: 1px dashed #d1d5db;
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  text-align: right;
  background: #fefce8;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.inline-cost-input:hover { border-color: #9ca3af; border-style: solid; }
.inline-cost-input:focus { outline: none; border-color: var(--accent); border-style: solid; box-shadow: 0 0 0 2px rgba(17,24,39,0.08); background: #fff; }
.inline-cost-input::placeholder { color: #d1d5db; }

.cell-save-ind {
  font-size: 11px;
  color: var(--green);
  font-weight: 600;
  margin-left: 4px;
}

/* --- Need Quotation badge --- */
.badge-need {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.badge-nosales {
  background: #f3f4f6;
  color: #9ca3af;
}

/* --- Product dropdown row --- */
.product-dropdown-row td { padding: 0 !important; border-bottom: 1px solid var(--border) !important; }
.product-dropdown-cell { background: #fafbfc; }
.row-expanded { background: #f5f7fa; }
.row-expanded:hover { background: #f0f2f5 !important; }

.product-dd-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
}

/* Note button column */
.search-card-btn-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Card action buttons — same width, no hover */
.search-card-btn-col .card-action-btn,
.search-card-btn-col .btn-note-link {
  width: 120px;
  text-align: center;
}

.btn-note-link {
  background: #fffbeb;
  border: 1px solid #d97706;
  color: #d97706;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
}
.btn-note-link:hover { border-color: var(--border); color: var(--text-secondary); }
.card-action-btn:hover { background: var(--accent); opacity: 1; }

/* Note form (below search card) */
.note-form {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-top: -1px;
}

.note-form-inner {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  align-items: center;
}

.note-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
}
.note-input:focus { outline: none; border-color: var(--accent); }

/* Note display in pending module */
.note-card .search-card { border-left: 3px solid var(--yellow); }
.note-text-display { font-size: 12px; color: var(--text); margin-top: 4px; font-style: italic; }
.badge-note { background: var(--yellow-bg); color: var(--yellow); }

/* Pending card */
.pending-card { margin-bottom: 8px; }
.pending-card .search-card { cursor: pointer; transition: border-color 0.15s; }
.pending-card .search-card:hover { border-color: var(--accent); }
.pending-date { font-size: 12px; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; }

/* --- Section Divider --- */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 16px;
}
.section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.section-divider-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* --- Filters Row --- */
.filters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.range-tabs {
  display: flex;
  gap: 4px;
}

.range-tab {
  padding: 5px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.range-tab:hover { background: #f3f4f6; }
.range-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.date-range-wrapper {
  position: relative;
  margin-left: auto;
}

/* --- Calendar Dropdown --- */
.calendar-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 14px;
  z-index: 200;
  width: 280px;
}
.calendar-dropdown.open { display: block; }

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.88rem;
  font-weight: 600;
}
.cal-nav {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
}
.cal-nav:hover { background: #f3f4f6; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-dow {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 0;
}

.cal-day {
  text-align: center;
  font-size: 0.8rem;
  padding: 6px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.1s;
}
.cal-day:hover { background: #f3f4f6; }
.cal-day.empty { cursor: default; }
.cal-day.empty:hover { background: none; }
.cal-day.today { font-weight: 700; color: var(--blue); }
.cal-day.range-start, .cal-day.range-end {
  background: var(--accent);
  color: #fff;
}
.cal-day.in-range {
  background: #e5e7eb;
}

.cal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* --- Quoted Label --- */
.quoted-label {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  background: var(--green-bg);
  color: var(--green);
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .header { padding: 0 12px; }
  .header-title { font-size: 0.88rem; }
  .header-left { gap: 12px; }
  .header-nav { gap: 2px; }
  .nav-btn { padding: 6px 10px; font-size: 0.8rem; }
  .main { padding: 14px; }
  .search-card { flex-wrap: wrap; }
  .search-card .btn { width: 100%; }
  .detail-header img { width: 60px; height: 60px; }
  .price-grid { grid-template-columns: 1fr; }
  .image-upload-row { flex-direction: column; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { min-width: auto; }
  .admin-actions { flex-direction: column; }
  .q-card { flex-wrap: wrap; }
  .q-card-right { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .user-label { display: none; }
  .filters-row { gap: 6px; }
  .range-tabs { flex-wrap: wrap; gap: 3px; }
  .range-tab { padding: 5px 10px; font-size: 0.72rem; }
  .calendar-dropdown { left: 0; right: auto; }
  .filter-tabs { gap: 3px; }
  .filter-tab { padding: 5px 10px; font-size: 0.72rem; }
  .dropdown-row-fields { gap: 6px; }
  .compact-field .cell-input { width: 64px; padding: 6px; }
  .dropdown-row-media { flex-direction: column; gap: 10px; }
  .dropdown-inner { padding: 14px; }
  .media-thumb, .media-empty, .media-notes { height: 90px; }
}

/* Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Timeline */
.timeline-list { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f3f4f6; font-size: 12px; }
.tl-item:last-child { border-bottom: none; }
.tl-icon { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.tl-approved .tl-icon { background: #ecfdf5; color: #059669; }
.tl-rejected .tl-icon { background: #fefce8; color: #dc2626; }
.tl-text { flex: 1; color: #374151; }
.tl-status { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.tl-approved .tl-status { color: #059669; }
.tl-rejected .tl-status { color: #dc2626; }
.tl-date { font-size: 11px; color: #9ca3af; white-space: nowrap; }

.note-hint { font-size: 10px; color: #9ca3af; white-space: nowrap; }

/* OOS buttons */
.btn-oos-item, .btn-oos-color {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  width: 120px;
  text-align: center;
}
.btn-oos-item { border-color: #dc2626; color: #dc2626; background: #fef2f2; }
.btn-oos-color { border-color: #d97706; color: #d97706; background: #fffbeb; }
