/**
 * HomeHelms — Material Design 3 (MD3) components
 * Colors come from themes.css (data-mode + data-accent)
 */
:root {
  --md-shape-corner-medium: 12px;
  --md-shape-corner-large: 16px;
  --md-shape-corner-full: 9999px;
  --nav-width: 72px;
  --nav-width-expanded: 280px;
  --topbar-height: 64px;
  font-family: 'Roboto', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  font-family: 'Roboto', system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  font-size: 1.25rem;
  line-height: 1;
}

/* Layout */
.app-nav {
  width: var(--nav-width);
  background: var(--md-sys-color-surface);
  border-right: 1px solid var(--md-sys-color-outline-variant);
  position: fixed;
  top: var(--topbar-height); left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
}
.app-nav__links { flex: 1; padding: 12px 8px 8px; }
.app-nav__link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 4px;
  border-radius: var(--md-shape-corner-full);
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  font-weight: 500;
  font-size: .875rem;
  transition: background .15s;
  position: relative;
}
.app-nav__link:hover { background: var(--md-sys-color-surface-container-high); }
.app-nav__link--active {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.app-nav__link--active .material-symbols-outlined { font-variation-settings: 'FILL' 1; }
.app-nav__footer {
  padding: 8px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.app-nav__user {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  color: var(--md-sys-color-on-surface-variant);
  position: relative;
}
.app-nav__link--footer { margin-bottom: 0; }

/* Icon-only nav: hide labels, show tooltip on hover/focus */
.app-nav--icons .app-nav__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.app-nav--icons .app-nav__link::after,
.app-nav--icons .app-nav__user::after {
  content: attr(aria-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 12px;
  border-radius: var(--md-shape-corner-medium);
  background: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface);
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 200;
  box-shadow: var(--md-elevation-2);
}
.app-nav--icons .app-nav__link:hover::after,
.app-nav--icons .app-nav__link:focus-visible::after,
.app-nav--icons .app-nav__user:hover::after {
  opacity: 1;
}

.app-shell { display: flex; min-height: calc(100vh - var(--topbar-height)); }
.app-main { flex: 1; margin-left: var(--nav-width); min-width: 0; }
.app-topbar {
  width: 100%;
  height: var(--topbar-height);
  background: var(--md-sys-color-surface);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  align-items: center;
  padding: 0 16px 0 8px;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 110;
}
.app-topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--md-sys-color-primary);
  flex-shrink: 0;
}
.app-topbar__brand-name { white-space: nowrap; }
.app-topbar__actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
.app-topbar__btn-label { display: inline; }
@media (max-width: 520px) {
  .app-topbar__btn-label { display: none; }
}
.app-content { padding: 24px; max-width: 1400px; }

/* Cards */
.md-card {
  background: var(--md-sys-color-surface);
  border-radius: var(--md-shape-corner-large);
  box-shadow: var(--md-elevation-1);
  overflow: hidden;
}
.md-card__header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.md-card__title { font-size: 1.375rem; font-weight: 400; margin: 0; }
.md-card__subtitle { font-size: .875rem; color: var(--md-sys-color-on-surface-variant); margin: 4px 0 0; }
.md-card__body { padding: 20px 24px 24px; }
.md-card--filled { background: var(--md-sys-color-surface-container-high); box-shadow: none; }

/* Buttons */
.md-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--md-shape-corner-full);
  background: transparent;
  font: 500 .875rem/1.25 'Roboto', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow .15s, background .15s;
  white-space: nowrap;
}
.md-btn--filled { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); box-shadow: var(--md-elevation-1); }
.md-btn--filled:hover { box-shadow: var(--md-elevation-2); filter: brightness(1.05); }
.md-btn--tonal { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.md-btn--outlined { background: transparent; color: var(--md-sys-color-primary); border: 1px solid var(--md-sys-color-outline); }
.md-btn--text { background: transparent; color: var(--md-sys-color-primary); padding: 10px 12px; }
.md-btn--icon { padding: 10px; border-radius: 50%; min-width: 40px; color: var(--md-sys-color-on-surface-variant); }
.md-btn--icon:hover { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); }
.md-btn--sm { padding: 8px 16px; font-size: .8125rem; }

/* Form fields */
.md-field { margin-bottom: 16px; }
.md-field label {
  display: block;
  font-size: .75rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 6px;
}
.md-field--error label {
  color: var(--md-sys-color-error);
}
.md-field--error .md-input,
.md-field--error .md-select,
.md-field--error .md-date__display {
  border-bottom-color: var(--md-sys-color-error);
}
.md-input, .md-select, .md-textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 4px 4px 0 0;
  background: var(--md-sys-color-surface-container-high);
  font: 400 1rem/1.5 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface);
  border-bottom: 2px solid var(--md-sys-color-on-surface-variant);
  border-top: none; border-left: none; border-right: none;
  transition: border-color .15s, background .15s;
}
.md-input:focus, .md-select:focus, .md-textarea:focus {
  outline: none;
  border-bottom-color: var(--md-sys-color-primary);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.md-input[readonly] {
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  cursor: default;
}
.md-textarea { min-height: 96px; resize: vertical; }
.md-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.md-form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.md-form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Form + list split pages (stores, payments, returns) */
.md-page-split {
  display: grid;
  grid-template-columns: minmax(min(100%, 340px), 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.md-page-split > .md-card { min-width: 0; }
@media (max-width: 900px) {
  .md-page-split { grid-template-columns: 1fr; }
  .md-form-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .md-form-grid--2,
  .md-form-grid--3 { grid-template-columns: 1fr; }
}

/* Date picker */
.md-date {
  position: relative;
  display: flex;
  align-items: stretch;
}
.md-date__display {
  flex: 1;
  padding-right: 44px;
  cursor: pointer;
}
.md-date__toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.md-date__toggle:hover {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-primary);
}
.md-date__popover {
  position: fixed;
  z-index: 400;
  width: min(320px, calc(100vw - 16px));
}
.md-date__nav .material-symbols-outlined {
  pointer-events: none;
}
.md-date__panel {
  padding: 12px;
  border-radius: var(--md-shape-corner-large);
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: var(--md-elevation-3, 0 8px 24px rgba(0, 0, 0, .22));
}
.md-date__header {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}
.md-date__month {
  text-align: center;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}
.md-date__heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}
.md-date__month-name {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
}
.md-date__year-btn {
  padding: 2px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font: 600 .9375rem/1.2 'Roboto', sans-serif;
  color: var(--md-sys-color-primary);
  cursor: pointer;
  transition: background .12s;
}
.md-date__year-btn:hover {
  background: color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent);
}
.md-date__range-label {
  text-align: center;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}
.md-date__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
}
.md-date__nav:hover {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}
.md-date__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.md-date__weekdays span {
  text-align: center;
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
  padding: 4px 0;
}
.md-date__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.md-date__day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  min-height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  font: 500 .8125rem/1 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.md-date__day:hover {
  background: var(--md-sys-color-surface-container-high);
}
.md-date__day--muted {
  color: var(--md-sys-color-outline);
}
.md-date__day--today {
  box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
}
.md-date__day--selected {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}
.md-date__day--selected:hover {
  background: var(--md-sys-color-primary);
  filter: brightness(1.05);
}
.md-date__year-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.md-date__year {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 4px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font: 500 .8125rem/1 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.md-date__year:hover {
  background: var(--md-sys-color-surface-container-high);
}
.md-date__year--current {
  box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
}
.md-date__year--viewing {
  color: var(--md-sys-color-primary);
  font-weight: 600;
}
.md-date__year--selected {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}
.md-date__year--selected:hover {
  background: var(--md-sys-color-primary);
  filter: brightness(1.05);
}
.md-date__footer {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}
.md-date__footer-btn {
  padding: 6px 12px;
  border: none;
  border-radius: var(--md-shape-corner-full);
  background: transparent;
  font: 500 .8125rem/1.25 'Roboto', sans-serif;
  color: var(--md-sys-color-primary);
  cursor: pointer;
}
.md-date__footer-btn:hover {
  background: color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent);
}

/* Tables */
.md-table-wrap { overflow-x: auto; border-radius: var(--md-shape-corner-medium); }
.md-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.md-table th {
  text-align: left;
  padding: 14px 16px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.md-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.md-table tr:hover td { background: var(--md-sys-color-surface-container); }
.md-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.stores-table__actions { width: 1%; white-space: nowrap; }
.stores-table__actions .gap-row { flex-wrap: nowrap; }

.stores-add-panel {
  margin-bottom: 20px;
  padding: 20px;
  border-radius: var(--md-shape-corner-large);
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
}
.stores-add-panel[hidden] { display: none !important; }
.stores-add-panel__title {
  margin: 0 0 16px;
  font-size: 1.125rem;
  font-weight: 500;
}
.stores-add-panel__actions { margin-top: 4px; }

/* Central inventory */
.inv-page {
  max-width: 1120px;
  margin: 0 auto;
}

.inv-card__header {
  padding: 18px 20px 0;
}
.inv-card__title {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.25;
}
.inv-card__subtitle {
  font-size: 0.8125rem;
  margin-top: 2px;
}
.inv-card__body {
  padding: 16px 20px 24px;
}

.inv-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.inv-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
}
.inv-stat--warn {
  border-color: color-mix(in srgb, var(--md-sys-color-error) 30%, var(--md-sys-color-outline-variant));
  background: color-mix(in srgb, var(--md-sys-color-error-container) 35%, var(--md-sys-color-surface-container-low));
}
.inv-stat__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}
.inv-stat__value {
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--md-sys-color-on-surface);
}
.inv-stat--warn .inv-stat__value {
  color: var(--md-sys-color-error);
}

.inv-panel {
  position: sticky;
  top: calc(var(--topbar-height) + 8px);
  z-index: 20;
  margin-bottom: 24px;
  padding: 16px;
  border-radius: 14px;
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.inv-panel__section + .inv-panel__section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 70%, transparent);
}
.inv-panel__heading {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}
.inv-panel__empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 12px;
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface-variant);
}
.inv-panel__empty p { margin: 0; flex: 1; }
.inv-panel__empty .material-symbols-outlined {
  font-size: 1.25rem;
  color: var(--md-sys-color-primary);
}

.inv-field {
  margin: 0;
  min-width: 0;
}
.inv-field label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}
.inv-page .inv-field .md-input,
.inv-page .inv-field .md-select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 8px;
  background: var(--md-sys-color-surface);
  font-size: 0.875rem;
  line-height: 1.25;
  color: var(--md-sys-color-on-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.inv-page .inv-field .md-input:focus,
.inv-page .inv-field .md-select:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--md-sys-color-primary) 18%, transparent);
}

.inv-form-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(88px, 1fr) minmax(88px, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.inv-form-row--search {
  grid-template-columns: minmax(0, 1fr) auto auto;
}
.inv-form-row__action {
  height: 40px;
  padding: 0 18px;
  font-size: 0.8125rem;
  align-self: end;
}
.inv-form-row__action.md-btn--text {
  height: 40px;
  padding: 0 12px;
}

.inv-section-title {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}
.inv-section-title__hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--md-sys-color-primary);
}

.inv-stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.inv-empty { margin-top: 4px; }

.inv-product {
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 12px;
  overflow: hidden;
  background: var(--md-sys-color-surface);
}
.inv-product__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--md-sys-color-surface-container-low);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.inv-product__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}
.inv-product__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.inv-product__total {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.inv-product__alert {
  padding: 2px 8px;
  border-radius: var(--md-shape-corner-full);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--md-sys-color-error);
  background: var(--md-sys-color-error-container);
  white-space: nowrap;
}
.inv-product__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.inv-product__table th {
  padding: 8px 14px;
  text-align: left;
  font-size: 0.625rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container);
}
.inv-product__table th.num,
.inv-product__table td.num {
  text-align: right;
}
.inv-product__table td {
  padding: 8px 14px;
  border-top: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 55%, transparent);
  vertical-align: middle;
}
.inv-product__table tbody tr:hover td {
  background: color-mix(in srgb, var(--md-sys-color-surface-container) 45%, transparent);
}
.inv-col-date {
  text-align: right;
  font-size: 0.75rem;
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
}
.inv-size-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 3px 8px;
  border-radius: var(--md-shape-corner-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
}
.inv-qty {
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.inv-stock--ok { color: var(--md-sys-color-success, #146c2e); }
.inv-stock--low { color: var(--md-sys-color-error); }
.inv-stock--out { color: var(--md-sys-color-on-surface-variant); }

@media (max-width: 860px) {
  .inv-stats {
    grid-template-columns: 1fr;
  }
  .inv-form-row {
    grid-template-columns: 1fr 1fr;
  }
  .inv-field--product {
    grid-column: 1 / -1;
  }
  .inv-form-row__action {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
  }
  .inv-form-row--search {
    grid-template-columns: 1fr;
  }
  .inv-form-row--search .inv-form-row__action {
    width: auto;
  }
  .inv-stock-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .inv-card__body {
    padding-left: 16px;
    padding-right: 16px;
  }
  .inv-panel {
    padding: 12px;
  }
  .inv-form-row {
    grid-template-columns: 1fr;
  }
  .inv-col-date {
    white-space: normal;
  }
}

/* Chips */
.md-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--md-shape-corner-full);
  font-size: .75rem;
  font-weight: 500;
}
.md-chip--success { background: var(--md-sys-color-success-container); color: var(--md-sys-color-success); }
.md-chip--error { background: var(--md-sys-color-error-container); color: var(--md-sys-color-error); }
.md-chip--neutral { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface-variant); }
.md-chip--primary { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }

/* Snackbar / alerts */
.md-snackbar {
  padding: 14px 16px;
  border-radius: var(--md-shape-corner-medium);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .875rem;
  box-shadow: var(--md-elevation-2);
}
.md-snackbar--success { background: var(--md-sys-color-success-container); color: var(--md-sys-color-on-success); }
.md-snackbar--error { background: var(--md-sys-color-error-container); color: var(--md-sys-color-error); }

/* Store tiles */
.md-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.md-tile {
  background: var(--md-sys-color-surface);
  border-radius: var(--md-shape-corner-large);
  box-shadow: var(--md-elevation-1);
  padding: 20px;
  transition: box-shadow .2s;
}
.md-tile:hover { box-shadow: var(--md-elevation-3); }
.md-tile__title { font-size: 1.125rem; font-weight: 500; margin: 0 0 4px; }
.md-tile__meta { font-size: .8125rem; color: var(--md-sys-color-on-surface-variant); }
.md-tile__stat { font-size: .875rem; margin-top: 12px; }
.md-tile__stat strong { color: var(--md-sys-color-error); }
.md-tile__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.md-tile__actions .md-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.md-tile__actions .md-btn .material-symbols-outlined {
  font-size: 1.125rem;
}

/* Login */
.login-page {
  min-height: calc(100vh - var(--topbar-height));
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--md-login-bg);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--md-sys-color-surface);
  border-radius: 28px;
  box-shadow: var(--md-elevation-3);
  padding: 40px 32px;
}
.login-card__logo {
  width: 56px; height: 56px;
  background: var(--md-sys-color-primary-container);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: var(--md-sys-color-primary);
}
.login-card h1 { text-align: center; font-size: 1.5rem; font-weight: 400; margin: 0 0 4px; }
.login-card p { text-align: center; color: var(--md-sys-color-on-surface-variant); margin: 0 0 28px; font-size: .875rem; }

/* Toolbar filter row */
.md-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 20px; }
.md-toolbar .md-field { margin-bottom: 0; flex: 1; min-width: 140px; }
.reports-date-error {
  margin: -12px 0 16px;
  font-size: .8125rem;
  color: var(--md-sys-color-error);
}
.reports-date-error[hidden] {
  display: none !important;
}

.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: var(--md-shape-corner-medium);
  font-size: .875rem;
}
.form-alert--error {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-error);
}
.form-alert .material-symbols-outlined {
  flex-shrink: 0;
  margin-top: 1px;
}

/* Empty state */
.md-empty { text-align: center; padding: 48px 24px; color: var(--md-sys-color-on-surface-variant); }
.md-empty .material-symbols-outlined { font-size: 48px; opacity: .5; margin-bottom: 12px; }

/* Pagination */
.md-pagination { display: flex; gap: 8px; align-items: center; margin-top: 16px; font-size: .875rem; }

/* Mobile */
.nav-toggle { display: none; }
@media (max-width: 960px) {
  .app-nav { transform: translateX(-100%); }
  .app-nav.open {
    transform: translateX(0);
    box-shadow: var(--md-elevation-3);
    width: var(--nav-width-expanded);
  }
  .app-nav.open .app-nav__links { padding: 12px 12px 8px; }
  .app-nav.open .app-nav__link {
    justify-content: flex-start;
    padding: 12px 16px;
  }
  .app-nav.open .app-nav__label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }
  .app-nav.open .app-nav__link::after,
  .app-nav.open .app-nav__user::after { content: none; }
  .app-nav.open .app-nav__footer {
    padding: 16px;
    align-items: stretch;
    font-size: .75rem;
  }
  .app-nav.open .app-nav__user {
    justify-content: flex-start;
    padding: 0;
  }
  .app-main { margin-left: 0; }
  .nav-toggle { display: inline-flex; }
  .nav-scrim {
    display: none; position: fixed; inset: 0; background: var(--md-scrim); z-index: 90;
  }
  .nav-scrim.open { display: block; }
}

.text-muted { color: var(--md-sys-color-on-surface-variant); }
.text-error { color: var(--md-sys-color-error); }
.text-success { color: var(--md-sys-color-success); }
.mb-0 { margin-bottom: 0; }
.mt-16 { margin-top: 16px; }
.gap-row { display: flex; flex-wrap: wrap; gap: 8px; }

.reports-analytics { margin-top: 8px; }
.reports-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.reports-kpi { padding: 16px; }
.reports-kpi__label { font-size: .75rem; margin-bottom: 6px; }
.reports-kpi__value { font-size: 1.25rem; font-weight: 600; line-height: 1.2; }
.reports-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.reports-chart-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.reports-chart-card--wide { grid-column: 1 / -1; }
.reports-chart-card__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.reports-chart-card__head .material-symbols-outlined {
  color: var(--md-sys-color-primary);
  font-size: 24px;
  margin-top: 2px;
}
.reports-chart-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.reports-chart-card__subtitle {
  margin: 4px 0 0;
  font-size: .8125rem;
}
.reports-chart-card__canvas {
  position: relative;
  height: 260px;
}
@media (max-width: 900px) {
  .reports-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-charts { grid-template-columns: 1fr; }
  .reports-chart-card--wide { grid-column: auto; }
}
