:root {
  --bg: #0b1220;
  --panel: #111a2e;
  --panel-2: #0f172a;
  --text: #e5e7eb;
  --muted: #a5b4fc;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #60a5fa;
  --danger: #fb7185;
  --ok: #34d399;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg), #050814);
  color: var(--text);
}

.hidden { display: none !important; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tabs {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(17, 26, 46, 0.55);
  margin-bottom: 14px;
}

.tab {
  border: 1px solid transparent;
  background: transparent;
  color: rgba(229, 231, 235, 0.80);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}

.tab.active {
  background: rgba(96, 165, 250, 0.22);
  border-color: rgba(96, 165, 250, 0.35);
  color: var(--text);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.brand .sub {
  font-size: 12px;
  color: rgba(229, 231, 235, 0.70);
}

.grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  align-items: start;
}

.panel {
  background: rgba(17, 26, 46, 0.72);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-weight: 700;
  font-size: 14px;
}

.controls {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

input[type="text"],
input[type="number"],
select {
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  outline: none;
}

input[type="number"] {
  text-align: right;
}

.btn {
  border: 1px solid var(--border);
  background: rgba(96, 165, 250, 0.15);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease;
  font-weight: 600;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: rgba(96, 165, 250, 0.25);
  border-color: rgba(96, 165, 250, 0.45);
}

.btn.danger {
  background: rgba(251, 113, 133, 0.15);
  border-color: rgba(251, 113, 133, 0.45);
}

.btn.ghost {
  background: transparent;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: middle;
}

th {
  text-align: left;
  font-size: 12px;
  color: rgba(229, 231, 235, 0.75);
  position: sticky;
  top: 0;
  background: rgba(17, 26, 46, 0.95);
  z-index: 1;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: rgba(229, 231, 235, 0.92);
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.18), rgba(15, 23, 42, 0.55));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
  white-space: nowrap;
}

.badge.soft {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(15, 23, 42, 0.45);
}

.badge.danger {
  border-color: rgba(251, 113, 133, 0.45);
  background: linear-gradient(180deg, rgba(251, 113, 133, 0.16), rgba(15, 23, 42, 0.55));
}

.badge.ok {
  border-color: rgba(52, 211, 153, 0.45);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.16), rgba(15, 23, 42, 0.55));
}

tbody tr:hover td {
  background: rgba(96, 165, 250, 0.06);
}

.cart-sticky {
  position: sticky;
  top: 12px;
}

#cartExportArea {
  padding: 12px;
}

.export-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.export-brand {
  font-weight: 900;
  letter-spacing: 0.3px;
}

#cartExportArea.exporting {
  background: #ffffff;
  color: #111;
  border-radius: 12px;
}

#cartExportArea.exporting .muted {
  color: rgba(17, 17, 17, 0.70);
}

#cartExportArea.exporting .badge {
  border-color: rgba(0, 0, 0, 0.18);
  color: rgba(17, 17, 17, 0.88);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.04));
}

#cartExportArea.exporting table {
  color: #111;
}

#cartExportArea.exporting th {
  background: #f7f7f7;
  color: #333;
}

#cartExportArea.exporting .export-value {
  display: inline-block;
  min-width: 52px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  background: rgba(0, 0, 0, 0.02);
  font-variant-numeric: tabular-nums;
}

.cart-summary {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.summary-row strong {
  font-variant-numeric: tabular-nums;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.muted {
  color: rgba(229, 231, 235, 0.70);
  font-size: 12px;
}

.inline-input {
  width: 92px;
  padding: 8px 8px;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.qty-btn {
  padding: 8px 10px;
  border-radius: 10px;
  min-width: 38px;
  text-align: center;
  font-weight: 800;
}

.qty-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.55);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
  .cart-sticky { position: static; }
  .tabs { width: 100%; }
  .tab { flex: 1; }
}

@media print {
  body { background: #fff; color: #111; }
  .btn, .controls { display: none !important; }
  .panel { border: 1px solid #ddd; background: #fff; }
  th { background: #f7f7f7; color: #333; }
}

/* Inline Editing Styles */
.product-inline-input {
  width: 90px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  text-align: right;
  padding: 6px 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.product-inline-input:hover {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.2);
}
.product-inline-input:focus {
  background: rgba(15, 23, 42, 0.9);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}
.product-inline-input.saving {
  opacity: 0.6;
}
.product-inline-input.success {
  border-color: var(--ok) !important;
  background: rgba(52, 211, 153, 0.15) !important;
  box-shadow: 0 0 4px rgba(52, 211, 153, 0.4) !important;
}
.product-inline-input.error {
  border-color: var(--danger) !important;
  background: rgba(251, 113, 133, 0.15) !important;
  box-shadow: 0 0 4px rgba(251, 113, 133, 0.4) !important;
}

/* Edit Icon Button */
.btn-icon {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.btn-icon:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent);
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 20, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  background: rgba(17, 26, 46, 0.95);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: modalEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.modal-close {
  background: transparent;
  border: none;
  color: rgba(229, 231, 235, 0.6);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover {
  color: var(--text);
}
#productForm {
  padding: 20px;
  display: grid;
  gap: 16px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.form-group input,
.form-group select {
  width: 100%;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}
.btn-secondary {
  background: transparent;
  border-color: var(--border);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
}
