:root {
  --color-bg: #f7f6f3;
  --color-bg-dark: #263142;
  --color-primary: #263142;
  --color-accent: #ffb860;
  --color-success: #2cc98d;
  --color-error: #fa5f5f;
  --color-info: #4f8cff;
  --color-warning: #ffbe3c;
  --color-purple: #a580f7;
  --color-green: #19c37d;
  --color-orange: #ff9000;
  --color-card: #fffdfa;
  --color-shadow: rgba(40,48,80,0.12);
  --radius: 18px;
  --header-height: 68px;
  --nav-height: 62px;
  --sidebar-width: 96px;
  --transition: 0.18s cubic-bezier(.62,.02,.19,.99);
  --font-main: 'Inter', system-ui, sans-serif;
  --font-title: 'Jura', 'Inter', system-ui, sans-serif;
}
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-primary);
  font-family: var(--font-main);
  transition: background .2s, color .2s;
}
body.dark {
  --color-bg: #263142;
  --color-bg-dark: #1c2330;
  --color-card: #252e40;
  --color-primary: #f7f6f3;
  --color-shadow: rgba(0,0,0,0.14);
}
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* Header */
.header {
  height: var(--header-height);
  background: var(--color-bg-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  font-family: var(--font-title);
  font-size: 1.35rem;
  letter-spacing: 1.2px;
  font-weight: 700;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  box-shadow: 0 2px 10px var(--color-shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-logo img {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  object-fit: contain;
  background: #fffdfa;
  border: 2px solid #f7f6f3;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-profile {
  background: rgba(255,255,255,0.14);
  padding: 7px 17px;
  border-radius: 99px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-dark-toggle {
  cursor: pointer;
  background: #212939;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffe398;
  font-size: 1.3rem;
  border: none;
  transition: background .15s;
}
.header-dark-toggle:hover {
  background: #414d66;
}
/* Navigation (mobile bottom, desktop sidebar) */
.nav {
  height: var(--nav-height);
  background: #fffdfa;
  box-shadow: 0 -1px 8px var(--color-shadow);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-around;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  transition: background .2s;
}
body.dark .nav {
  background: #232b3a;
}
.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  color: #a1a8ba;
  font-size: 1.2rem;
  cursor: pointer;
  border: none;
  background: none;
  transition: color .17s;
  font-family: var(--font-main);
}
.nav-tab.active {
  color: var(--color-primary);
  font-weight: 600;
}
.nav-tab .material-icons {
  font-size: 2rem;
}
.nav-tab .nav-label {
  font-size: 0.82rem;
  margin-top: 1px;
  letter-spacing: 0.1em;
}
/* Main Content */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: var(--nav-height);
  padding: 0 0 22px 0;
  transition: background .2s;
}
@media (min-width: 900px) {
  .main {
    margin-left: var(--sidebar-width);
    margin-bottom: 0;
    padding: 0 38px 32px 38px;
  }
  .nav {
    display: none;
  }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: #232b3a;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 99;
    padding-top: 80px;
    gap: 16px;
    border-top-right-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
  }
  .sidebar-tab {
    background: none;
    border: none;
    color: #a9b3c5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 7px 0 7px 0;
    width: 100%;
    transition: background .1s, color .18s;
  }
  .sidebar-tab.active {
    color: var(--color-primary);
    background: #f7f6f3;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    font-weight: 700;
  }
  .sidebar-tab .material-icons {
    font-size: 1.7rem;
  }
  .sidebar-tab .nav-label {
    font-size: 0.77rem;
  }
}
/* Section: Cards, Pills, Buttons, Chips */
.section {
  margin-top: 22px;
  margin-bottom: 32px;
}
.section-title {
  font-family: var(--font-title);
  font-size: 2rem;
  letter-spacing: 1px;
  margin-bottom: 8px;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 14px;
}
.section-subtitle {
  color: #8794ad;
  font-size: 1.08rem;
  margin-bottom: 10px;
  font-weight: 400;
}
.card-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 18px;
}
.card {
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px var(--color-shadow);
  padding: 20px 22px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: background .14s;
  border: none;
}
.card .card-title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--color-primary);
  letter-spacing: .03em;
}
.card .card-subtitle {
  color: #888fab;
  font-size: 1rem;
  margin-bottom: 3px;
}
.card .card-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 10px;
  font-size: 0.94rem;
  border-radius: 9px;
  font-weight: 500;
  background: #f2f4fa;
  color: #3c4868;
  box-shadow: 0 1px 2px var(--color-shadow);
  margin-right: 5px;
}
.badge.instock { background: var(--color-green); color: #fff; }
.badge.lowstock { background: var(--color-warning); color: #fff; }
.badge.outstock { background: var(--color-error); color: #fff; }
.badge.category { background: var(--color-purple); color: #fff; }
.badge.store { background: var(--color-info); color: #fff; }
.badge.meal { background: var(--color-orange); color: #fff; }
/* Pills, Chips, Buttons */
.pill, .chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 17px;
  font-size: 1rem;
  font-weight: 600;
  background: #f0f2f7;
  color: #45517a;
  margin-right: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  border: none;
  transition: background .13s, color .13s;
  box-shadow: 0 1px 3px var(--color-shadow);
  outline: none;
}
.pill.selected, .chip.selected {
  background: var(--color-primary);
  color: #fff;
}
.btn {
  padding: 9px 24px;
  border-radius: 12px;
  border: none;
  font-size: 1.07rem;
  font-family: var(--font-main);
  font-weight: 600;
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--color-shadow);
  cursor: pointer;
  margin-right: 8px;
  margin-bottom: 6px;
  transition: background .13s;
}
.btn.secondary {
  background: #c9d2e6;
  color: #1a263c;
}
.btn.success {
  background: var(--color-green);
  color: #fff;
}
.btn.danger {
  background: var(--color-error);
  color: #fff;
}
.btn.warning {
  background: var(--color-warning);
  color: #fff;
}
.btn.info {
  background: var(--color-info);
  color: #fff;
}
.btn.outline {
  background: none;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn:active {
  filter: brightness(1.07);
}
/* Modal, Backdrop, Form */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(34,40,60,0.33);
  z-index: 990;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--color-card);
  padding: 32px 30px 18px 30px;
  border-radius: 20px;
  min-width: 340px;
  max-width: 94vw;
  box-shadow: 0 7px 40px 0 rgba(34,42,64,0.14);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.modal-title {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--color-primary);
}
.modal-content {
  margin-bottom: 18px;
}
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  justify-content: flex-end;
}
.modal input, .modal select, .modal textarea {
  padding: 11px 13px;
  font-size: 1.06rem;
  border-radius: 9px;
  border: 1.5px solid #e7eaf2;
  margin-bottom: 13px;
  font-family: var(--font-main);
  width: 100%;
  background: #fcfcfb;
  color: var(--color-primary);
  outline: none;
  transition: border .14s;
}
.modal input:focus, .modal select:focus, .modal textarea:focus {
  border: 1.5px solid var(--color-primary);
  background: #fff;
}
.modal label {
  font-size: 0.98rem;
  color: #5d6786;
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
}
/* Empty States & Helpers */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 38px 0 0 0;
  color: #bac0d0;
  font-size: 1.2rem;
}
.empty-state .material-icons {
  font-size: 3.5rem;
  color: #e6e6ec;
}
.divider {
  width: 100%;
  border: none;
  height: 1px;
  background: #e2e3e7;
  margin: 14px 0 20px 0;
}
.fade-in {
  animation: fadeIn .55s;
}
@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(8px);}
  100% { opacity: 1; transform: none;}
}
/* Utility */
.hide { display: none !important; }
/* Responsive adjustments */
@media (max-width: 700px) {
  .main { padding: 0 0 22px 0; }
  .header { padding: 0 10px; }
  .modal { min-width: 92vw; max-width: 98vw; }
  .sidebar { display: none !important; }
}
