/* ══════════════════════════════════════════════════════════════
   VersaBold Innovations — Design System
   Theme: Dark industrial / editorial precision
   Fonts: Syne (display) + DM Mono (data/code)
   ══════════════════════════════════════════════════════════════ */

:root {
  /* ── Brand palette ── */
  --black:       #0A0A0A;
  --surface:     #111111;
  --surface-2:   #1A1A1A;
  --surface-3:   #242424;
  --border:      #2C2C2C;
  --border-soft: #1E1E1E;

  --text-primary:   #F0EDE8;
  --text-secondary: #888880;
  --text-muted:     #444440;

  /* VersaBold accent — bold amber/gold + electric accent */
  --accent:       #E8A020;
  --accent-light: #F5B840;
  --accent-dim:   rgba(232, 160, 32, 0.12);
  --electric:     #00D4AA;
  --electric-dim: rgba(0, 212, 170, 0.10);

  /* Stock status */
  --ok:      #2EC55A;
  --warn:    #F0A020;
  --danger:  #E83A3A;
  --ok-dim:  rgba(46, 197, 90, 0.12);
  --warn-dim:rgba(240, 160, 32, 0.15);
  --danger-dim:rgba(232, 58, 58, 0.15);

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  56px;
  --radius:    6px;
  --radius-lg: 12px;
  --gap:       20px;

  /* Shadows */
  --shadow-card: 0 2px 12px rgba(0,0,0,0.5);
  --shadow-modal: 0 24px 64px rgba(0,0,0,0.8);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Syne', sans-serif;
  background: var(--black);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  width: 38px; height: 38px;
  background: var(--accent);
  color: var(--black);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-main { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.logo-sub  { font-size: 10px; font-weight: 400; color: var(--text-secondary); letter-spacing: 0.06em; text-transform: uppercase; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  position: relative;
}

.nav-item:hover { background: var(--surface-2); color: var(--text-primary); }

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(232, 160, 32, 0.2);
}

.nav-icon { font-size: 16px; width: 18px; text-align: center; }

.sidebar-bottom {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  font-family: 'DM Mono', monospace;
}

.sync-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sync-dot.online  { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.sync-dot.offline { background: var(--danger); }
.sync-dot.syncing { background: var(--warn); animation: pulse 1s infinite; }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ── Topbar (mobile) ───────────────────────────────────────── */
.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 300;
}

.menu-toggle {
  background: none; border: none;
  color: var(--text-primary);
  font-size: 20px; cursor: pointer;
  padding: 4px;
}

.topbar-title {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
}

/* ── Main content ──────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 36px var(--gap);
  max-width: 1200px;
}

/* ── Views ─────────────────────────────────────────────────── */
.view { display: none; animation: fadeIn 0.25s ease; }
.view.active { display: block; }

@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

.view-header { margin-bottom: 28px; }
.view-header h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
}
.view-sub { font-size: 13px; color: var(--text-secondary); margin-top: 6px; font-weight: 400; }

/* ── Toolbar ───────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 180px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 14px;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: var(--black);
  border: none;
  border-radius: var(--radius);
  padding: 9px 18px;
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-light); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface-3);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}
.btn-danger:hover { background: var(--danger-dim); }

.btn-large { padding: 14px 28px; font-size: 15px; }

.btn-install {
  background: var(--electric-dim);
  color: var(--electric);
  border: 1px solid rgba(0, 212, 170, 0.25);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.18s;
}
.btn-install:hover { background: rgba(0,212,170,0.2); }

/* ── Cards Grid ────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

/* ── Card ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: border-color 0.18s, transform 0.18s;
  position: relative;
  overflow: hidden;
}
.card:hover { border-color: var(--border-soft); border-color: #333; transform: translateY(-2px); box-shadow: var(--shadow-card); }

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

.card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.card-category {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
}

.card-price {
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  gap: 8px;
  flex-wrap: wrap;
}

.card-actions { display: flex; gap: 8px; }

/* ── Stock badge ───────────────────────────────────────────── */
.stock-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.stock-badge.ok     { background: var(--ok-dim);     color: var(--ok);    }
.stock-badge.warn   { background: var(--warn-dim);   color: var(--warn);  }
.stock-badge.danger { background: var(--danger-dim); color: var(--danger);}

.stock-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Status pill ───────────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
}
.pill.active   { background: var(--ok-dim);   color: var(--ok); }
.pill.inactive { background: var(--danger-dim); color: var(--danger); }
.pill.amazon   { background: var(--electric-dim); color: var(--electric); }

/* ── Form elements ─────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: 'DM Mono', monospace;
}

.form-input, .form-select, .form-textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--accent); }
.form-select option { background: var(--surface-2); }
.form-textarea { resize: vertical; min-height: 80px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.full { grid-column: 1 / -1; }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.form-check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
}

.amazon-fields {
  background: var(--electric-dim);
  border: 1px solid rgba(0,212,170,0.15);
  border-radius: var(--radius);
  padding: 14px;
  display: none;
}
.amazon-fields.visible { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.calc-result {
  grid-column: 1 / -1;
  background: var(--surface-3);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: overlayIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }

@keyframes overlayIn { from{opacity:0} to{opacity:1} }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  animation: modalIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: var(--shadow-modal);
}

@keyframes modalIn { from{opacity:0;transform:scale(0.92)} to{opacity:1;transform:none} }

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
}
.modal-close:hover { color: var(--text-primary); border-color: var(--text-secondary); }

.modal-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 20px;
  padding-right: 36px;
}

.modal-body { display: flex; flex-direction: column; gap: 14px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ── Order form ────────────────────────────────────────────── */
.order-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.order-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.order-panel h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  font-family: 'DM Mono', monospace;
}

.order-items { display: flex; flex-direction: column; gap: 10px; min-height: 200px; }

.order-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
}

.order-item-name { font-size: 13px; font-weight: 600; }
.order-item-qty  { font-family: 'DM Mono', monospace; font-size: 13px; width: 60px; }
.order-item-price { font-family: 'DM Mono', monospace; font-size: 13px; color: var(--accent); }
.order-item-del  { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 16px; padding: 0; }

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

.total-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; }
.total-amount { font-family: 'DM Mono', monospace; font-size: 22px; color: var(--accent); font-weight: 500; }

.service-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.service-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.service-chip:hover { border-color: var(--accent); }
.service-chip.selected { background: var(--accent-dim); border-color: var(--accent); }
.service-chip-name { font-size: 12px; font-weight: 600; line-height: 1.3; }
.service-chip-price { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--accent); margin-top: 2px; }

/* ── Summary view ──────────────────────────────────────────── */
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 20px;
}

.summary-stat {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-box {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border-soft);
}
.stat-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-family: 'DM Mono', monospace; }
.stat-value { font-family: 'DM Mono', monospace; font-size: 20px; color: var(--accent); margin-top: 6px; font-weight: 500; }

.narrative-box {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
  border-left: 3px solid var(--electric);
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 1000;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  min-width: 240px;
  max-width: 340px;
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: var(--shadow-card);
  display: flex; align-items: center; gap: 10px;
}
.toast.success { border-color: var(--ok); color: var(--ok); }
.toast.error   { border-color: var(--danger); color: var(--danger); }
.toast.info    { border-color: var(--accent); color: var(--accent); }
.toast.out { animation: toastOut 0.25s ease forwards; }

@keyframes toastIn  { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:none} }
@keyframes toastOut { from{opacity:1;transform:none} to{opacity:0;transform:translateX(20px)} }

/* ── Loading ───────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { from{background-position:200% 0} to{background-position:-200% 0} }

.loader {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  flex-direction: column;
  gap: 12px;
}

.spin {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to{transform:rotate(360deg)} }

/* ── Divider ───────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 8px 0; }

/* ── Utility ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.mono { font-family: 'DM Mono', monospace; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); font-size: 13px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,0.7);
  }

  .topbar { display: flex; }

  .main-content {
    margin-left: 0;
    padding-top: calc(var(--topbar-h) + 20px);
    padding-left: 14px;
    padding-right: 14px;
  }

  .form-grid { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr 1fr; }
  .order-grid { grid-template-columns: 1fr; }
  .summary-stat { grid-template-columns: 1fr 1fr; }
  .service-selector { grid-template-columns: 1fr; }
  .amazon-fields.visible { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .form-grid.cols-3 { grid-template-columns: 1fr; }
  .summary-stat { grid-template-columns: 1fr; }
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3C3C3C; }

/* ── Order form sections ────────────────────────────────────── */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.form-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: 'DM Mono', monospace;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}

.form-grid-full { grid-column: 1 / -1; }

/* ── Services checklist ─────────────────────────────────────── */
.services-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.service-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.service-check-item:hover { border-color: var(--accent); }
.service-check-item:has(input:checked) {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.service-check-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px; height: 14px;
  flex-shrink: 0;
}
.sci-name  { flex: 1; font-size: 12px; font-weight: 600; line-height: 1.3; }
.sci-price { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--accent); white-space: nowrap; }

/* ── Form actions ───────────────────────────────────────────── */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 4px;
}

@media (max-width: 768px) {
  .services-checklist { grid-template-columns: 1fr 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn-primary, .form-actions .btn-secondary { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .services-checklist { grid-template-columns: 1fr; }
}