:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --primary: #1f6feb;
  --text: #1d2433;
  --muted: #667085;
  --border: #e5e7eb;
  --sidebar-bg: #101827;
  --sidebar-text: #e5e7eb;
  --success: #1f9d63;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 20px 16px;
}

.brand {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 24px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar a {
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
}

.sidebar a:hover {
  background: rgba(255,255,255,0.08);
}

.main-content {
  flex: 1;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.install-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef4ff, #f7fafc);
}

.install-box {
  width: min(620px, 90vw);
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.06);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

input, select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.auth-panel {
  max-width: 420px;
  margin: 120px auto;
  padding: 30px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.auth-panel input {
  display: block;
  width: 100%;
  margin: 8px 0 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
}

button:hover {
  opacity: 0.95;
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.alert-error {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
}

.pos-layout {
  display: grid;
  grid-template-columns: 2.1fr 1fr;
  gap: 20px;
  min-height: 70vh;
}

.pos-products, .pos-cart {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.pos-cart {
  position: sticky;
  top: 24px;
  height: fit-content;
}

.pos-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.product-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 120ms ease, box-shadow 120ms ease;
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(31,111,235,0.08);
}

.product-image {
  display: grid;
  place-items: center;
  background: #eff6ff;
  height: 72px;
  width: 72px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-weight: bold;
  color: var(--primary);
  align-self: center;
}

.quick-add-btn {
  background: var(--success);
  color: white;
  border: none;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 700;
  align-self: stretch;
}

.quick-add-btn:hover { opacity: 0.95; }

.totals {
  margin: 18px 0;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
  margin: 8px 0;
}

.totals div {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
}

.primary-btn {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font-weight: 700;
}

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .form-grid,
  .pos-layout {
    grid-template-columns: 1fr;
  }
}
