:root {
  --primary: #0d6efd;
  --primary-dark: #0a58ca;
  --success: #198754;
  --danger: #dc3545;
  --warning: #ffc107;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #212529;
  --muted: #6c757d;
  --border: #dee2e6;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 70px;
}

.app-header {
  background: var(--primary);
  color: white;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.logo { font-weight: 700; font-size: 1.15rem; cursor: pointer; }

.user-badge {
  background: rgba(255,255,255,.2);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
}

.hidden { display: none !important; }

main { padding: 16px; max-width: 640px; margin: 0 auto; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.card h2, .card h3 { margin-bottom: 10px; }

.btn {
  display: inline-block;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background .15s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-block { display: block; width: 100%; margin-top: 10px; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--muted);
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}

.product-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.product-item:last-child { border-bottom: none; }
.product-info h4 { font-size: 0.95rem; }
.product-info .meta { font-size: 0.8rem; color: var(--muted); }
.price { font-weight: 700; color: var(--success); }
.mrp { text-decoration: line-through; color: var(--muted); font-size: 0.8rem; margin-left: 6px; }

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty-control button {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--primary);
  background: white;
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.cart-bar {
  position: fixed;
  bottom: 60px;
  left: 0; right: 0;
  background: var(--success);
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  z-index: 90;
  max-width: 640px;
  margin: 0 auto;
  border-radius: 12px 12px 0 0;
}

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  z-index: 100;
}
.bottom-nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
  flex: 1;
}
.bottom-nav a.active { color: var(--primary); font-weight: 600; }
.bottom-nav .icon { font-size: 1.3rem; display: block; }

.role-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 20px;
}
.role-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .15s;
}
.role-card:hover, .role-card.selected { border-color: var(--primary); }
.role-card .emoji { font-size: 2.2rem; margin-bottom: 8px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-placed { background: #cff4fc; color: #055160; }
.badge-accepted { background: #d1e7dd; color: #0f5132; }
.badge-ready { background: #fff3cd; color: #664d03; }
.badge-completed { background: #d1e7dd; color: #0f5132; }
.badge-cancelled { background: #f8d7da; color: #842029; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f1f3f5; font-weight: 600; }

.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  z-index: 200;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity .3s;
}
.toast.show { opacity: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  padding: 6px 12px;
  border-radius: 20px;
  background: #e9ecef;
  font-size: 0.8rem;
  cursor: pointer;
}
.chip.active { background: var(--primary); color: white; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
