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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --accent: #25d366;
  --accent-dark: #1aab52;
  --text: #f0f0f0;
  --muted: #888;
  --danger: #e74c3c;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 480px; margin: 0 auto; padding: 24px 20px; }
.container-wide { max-width: 800px; margin: 0 auto; padding: 24px 20px; }

/* Header */
.header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.logo { font-size: 20px; font-weight: 700; color: var(--accent); letter-spacing: -0.5px; }
.logo span { color: var(--text); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

/* Forms */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; color: var(--text); font-size: 14px; outline: none; transition: border-color 0.2s; }
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 24px; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; width: 100%; }
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Steps */
.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 32px; }
.step { width: 32px; height: 4px; background: var(--border); border-radius: 2px; flex: 1; transition: background 0.3s; }
.step.active { background: var(--accent); }
.step.done { background: var(--accent-dark); }

/* Status badge */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-green { background: rgba(37,211,102,0.15); color: var(--accent); }
.badge-red { background: rgba(231,76,60,0.15); color: var(--danger); }
.badge-gray { background: var(--surface2); color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* QR code */
.qr-wrapper { display: flex; flex-direction: column; align-items: center; padding: 24px; }
.qr-wrapper img { width: 200px; height: 200px; border-radius: 8px; background: #fff; padding: 8px; }
.qr-hint { font-size: 13px; color: var(--muted); text-align: center; margin-top: 12px; }

/* Toggle */
.toggle-wrapper { display: flex; align-items: center; justify-content: space-between; }
.toggle { position: relative; width: 48px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--border); border-radius: 26px; cursor: pointer; transition: 0.3s; }
.toggle-slider:before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider:before { transform: translateX(22px); }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Product list */
.product-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.product-item:last-child { border-bottom: none; }
.product-name { font-size: 13px; flex: 1; margin-right: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Checkbox group */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item { display: flex; align-items: center; gap: 6px; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.checkbox-item input { width: auto; }
.checkbox-item.checked { border-color: var(--accent); color: var(--accent); }

/* Error / success */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: rgba(231,76,60,0.1); border: 1px solid var(--danger); color: var(--danger); }
.alert-success { background: rgba(37,211,102,0.1); border: 1px solid var(--accent); color: var(--accent); }

/* Loader */
.loader { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Sidebar app layout */
.app-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 16px 24px;
}
.sidebar .logo { margin-bottom: 36px; padding-left: 4px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--muted);
  text-decoration: none; transition: all 0.2s;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: var(--surface2); color: var(--text); text-decoration: none; }
.sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border); }
.sidebar-footer button {
  background: none; border: none; color: var(--muted); font-size: 13px;
  cursor: pointer; padding: 8px 12px; border-radius: 8px;
  width: 100%; text-align: left; transition: all 0.2s;
}
.sidebar-footer button:hover { background: var(--surface2); color: var(--text); }
.main-content { padding: 32px; min-width: 0; overflow-x: hidden; }

@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar {
    flex-direction: row; align-items: center; padding: 16px 20px;
    border-right: none; border-bottom: 1px solid var(--border);
    grid-row: 1;
  }
  .sidebar .logo { margin-bottom: 0; flex: 1; }
  .sidebar-nav { flex-direction: row; gap: 4px; flex: 0; }
  .sidebar-nav a .nav-icon { display: none; }
  .sidebar-footer { margin-top: 0; padding-top: 0; border-top: none; }
  .main-content { padding: 20px 16px; grid-row: 2; }
}

/* Utility */
.text-muted { color: var(--muted); font-size: 13px; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.hidden { display: none !important; }

/* Range slider */
input[type=range] { -webkit-appearance: none; height: 4px; background: var(--border); border-radius: 2px; padding: 0; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; }
.range-value { font-size: 20px; font-weight: 700; color: var(--accent); }

/* Filters */
.filter-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
.filter-item:last-child { border-bottom: none; padding-bottom: 0; }
.filter-item:first-child { padding-top: 0; }
.filter-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filter-label { font-size: 14px; font-weight: 500; }
.filter-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.filter-body { margin-top: 12px; }
.filter-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin: 20px 0 12px; }

/* Responsive */
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
