/* ============================================================
   Inventory Control — Design System
   Tema claro, mobile-first, cor primária #239753
   ============================================================ */

:root {
  --primary:       #239753;
  --primary-dark:  #1a7040;
  --primary-light: #e8f5ee;
  --secondary:     #375637;
  --bg:            #f4f6f4;
  --card-bg:       #ffffff;
  --text:          #1c1c1c;
  --text-muted:    #6b7280;
  --border:        #dde3dd;
  --shadow:        0 1px 4px rgba(0,0,0,0.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.12);
  --radius:        10px;
  --radius-sm:     6px;

  /* Status dos pedidos por loja */
  --s-no-order:  #9e9e9e;
  --s-placed:    #f59e0b;
  --s-sent:      #239753;
  --s-received:  #3b82f6;

  /* Status da janela */
  --w-open:      #239753;
  --w-closed:    #6b7280;
  --w-cancelled: #ef4444;

  --sidebar-w: 230px;
  --header-h:  56px;
}

/* ============================================================ Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ============================================================ Login */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
  padding: 1rem;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}

.logo-icon.large {
  width: 64px;
  height: 64px;
  font-size: 1.4rem;
}

.login-logo h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--secondary);
}

.login-logo p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.login-form .form-group { margin-bottom: 1.25rem; }

.form-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #dc2626;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* ============================================================ App Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ============================================================ Sidebar */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}

.sidebar.open {
  transform: translateX(0);
  box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
  .sidebar {
    transform: translateX(0);
    box-shadow: none;
  }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
}

.sidebar-overlay.active {
  display: block;
}

@media (min-width: 768px) {
  .sidebar-overlay { display: none !important; }
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  font-size: 0.85rem;
  margin-bottom: 0;
  flex-shrink: 0;
}

.logo-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.2;
}

.sidebar-close {
  font-size: 1.1rem;
  color: var(--text-muted);
  padding: 0.25rem;
}

@media (min-width: 768px) {
  .sidebar-close { display: none; }
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.nav-item:hover { background: var(--primary-light); color: var(--primary); }

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-item .nav-icon {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 1rem 0.75rem 0.375rem;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.user-info {
  margin-bottom: 0.75rem;
}

.user-info .user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.user-info .user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.btn-logout {
  width: 100%;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: transparent;
  transition: all 0.15s;
}

.btn-logout:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

/* ============================================================ Main */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.25s;
}

@media (min-width: 768px) {
  .main-wrapper { margin-left: var(--sidebar-w); }
}

.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
}

.refresh-btn {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}
.refresh-btn:hover { color: var(--text); background: var(--hover-bg, #f3f4f6); }
.refresh-btn.spinning svg { animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0.25rem;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.2s;
}

@media (min-width: 768px) {
  .hamburger { display: none; }
}

.page-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.main-content {
  flex: 1;
  padding: 1.5rem 1.25rem;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

/* ============================================================ Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.card-body { padding: 1.25rem; }

/* ============================================================ Formulário */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--card-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(35,151,83,0.12);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ============================================================ Botões */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}

.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-secondary:hover { background: var(--primary-light); }

.btn-danger {
  background: #ef4444;
  color: #fff;
  border: 1px solid #ef4444;
}

.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--bg); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }

.btn-block { width: 100%; }

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ============================================================ Badge de Status */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-open     { background: #dcfce7; color: #166534; }
.badge-closed   { background: #f3f4f6; color: #374151; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-warning  { background: #fef3c7; color: #92400e; }

/* ============================================================ Grade de Lojas */
.store-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.store-square {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  cursor: default;
  user-select: none;
  letter-spacing: 0.04em;
  transition: transform 0.15s;
}

.store-square:hover { transform: scale(1.1); }

.store-square[data-status="no_order"]      { background: var(--s-no-order); }
.store-square[data-status="order_placed"]  { background: var(--s-placed); }
.store-square[data-status="order_sent"]    { background: var(--s-sent); }
.store-square[data-status="order_received"]{ background: var(--s-received); }

/* Tooltip */
.store-square .tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28,28,28,0.92);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.35rem 0.6rem;
  border-radius: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.store-square .tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(28,28,28,0.92);
}

.store-square:hover .tooltip,
.store-square.tooltip-visible .tooltip {
  opacity: 1;
}

/* ============================================================ Legenda */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ============================================================ Info do card da janela */
.window-info {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.info-item label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.info-item .info-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* ============================================================ Tabela */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

@media (max-width: 640px) {
  table { font-size: 0.78rem; }
  th, td { padding: 0.5rem 0.6rem; }
}

thead tr { background: var(--bg); }

th {
  padding: 0.625rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr:hover { background: var(--bg); }

.td-actions { display: flex; gap: 0.5rem; }

/* ============================================================ Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  background: transparent;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-btn:hover:not(.active) { color: var(--text); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================ Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 1rem;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.modal-close {
  font-size: 1rem;
  color: var(--text-muted);
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { background: var(--bg); }

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ============================================================ Confirm Dialog */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1rem;
}

.confirm-dialog {
  background: var(--card-bg);
  border-radius: var(--radius);
  width: 100%;
  max-width: 380px;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.confirm-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.confirm-message {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 0.625rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ============================================================ SearchableSelect */
.ss-dropdown-global {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  display: none;
}

.ss-dropdown-global .ss-search-wrap {
  padding: .375rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card-bg);
}

.ss-dropdown-global .ss-search {
  display: block;
  width: 100%;
  padding: .3rem .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-family: inherit;
}
.ss-dropdown-global .ss-search:focus { outline: none; border-color: var(--primary); }

.ss-dropdown-global .ss-options-list { max-height: 200px; overflow-y: auto; }

.ss-dropdown-global .ss-option {
  padding: .4rem .75rem;
  cursor: pointer;
  font-size: .875rem;
  white-space: nowrap;
}
.ss-dropdown-global .ss-option:hover { background: var(--primary-light); }
.ss-dropdown-global .ss-option.active { color: var(--primary); font-weight: 600; }
.ss-dropdown-global .ss-no-results {
  padding: .5rem .75rem;
  color: var(--text-muted);
  font-size: .85rem;
}

.ss-wrapper { display: inline-block; vertical-align: middle; }

.ss-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .375rem;
  padding: .4rem .625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  cursor: pointer;
  font-size: .875rem;
  min-width: 160px;
  user-select: none;
  white-space: nowrap;
}
.ss-trigger:hover { border-color: var(--primary); }
.ss-trigger:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

.ss-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.ss-label[data-empty="1"] { color: var(--text-muted); }
.ss-chevron svg { display: block; flex-shrink: 0; }

.ss-compact .ss-trigger { padding: .25rem .5rem; font-size: .8rem; min-width: 120px; }

/* ============================================================ Supplier Groups (adm-orders) */
.supplier-group + .supplier-group { border-top: 1px dashed var(--border); }

.supplier-group-header {
  padding: .3rem 1rem;
  background: var(--bg);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.supplier-group-label.has-supplier { color: var(--secondary); }

/* ============================================================ Category Tabs (catalog) */
.category-tabs {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  padding: .625rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.category-tab {
  padding: .3rem .875rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.category-tab:hover { border-color: var(--primary); color: var(--primary); }
.category-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================================ Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--secondary);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 400;
  transition: transform 0.3s ease;
  white-space: normal;
  word-break: break-word;
  max-width: min(420px, calc(100vw - 2rem));
  text-align: center;
  box-shadow: var(--shadow-md);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.toast-error { background: #dc2626; }
.toast.toast-success { background: var(--primary); }

/* ============================================================ Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ============================================================ Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 0.75rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================ Alias tag */
.alias-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 5px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.75rem;
}

/* ============================================================ Seção do dashboard */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

/* ============================================================ Role badge */
.role-badge {
  display: inline-flex;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.role-system     { background: #fef3c7; color: #92400e; }
.role-adm        { background: #ede9fe; color: #5b21b6; }
.role-almoxarifado { background: var(--primary-light); color: var(--primary-dark); }
.role-lider      { background: #e0f2fe; color: #0369a1; }

/* ============================================================ Utilitários */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.text-sm { font-size: 0.85rem; }
.bold { font-weight: 700; }
.w-full { width: 100%; }

/* ============================================================
   Catálogo de Insumos
   ============================================================ */

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (min-width: 540px) { .catalog-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 860px) { .catalog-grid { grid-template-columns: repeat(4, 1fr); } }

.supply-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s;
}

.supply-card:hover { box-shadow: var(--shadow-md); }

.supply-img {
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.supply-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.supply-placeholder { font-size: 2.5rem; opacity: 0.3; }

.supply-info {
  padding: 0.625rem 0.75rem 0.25rem;
  flex: 1;
}

.supply-name {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
  margin-bottom: 0.2rem;
}

.supply-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.supply-actions {
  padding: 0.5rem 0.75rem 0.625rem;
  display: flex;
  gap: 0.375rem;
  align-items: center;
}

.supply-actions .qty-input {
  width: 64px;
  flex-shrink: 0;
  padding: 0.375rem 0.5rem;
  text-align: center;
  font-size: 0.85rem;
}

.supply-in-cart {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem 0.375rem;
  text-align: center;
}

/* ============================================================
   Carrinho
   ============================================================ */

.cart-list { display: flex; flex-direction: column; gap: 0.5rem; }

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  gap: 0.75rem;
}

.cart-item-info { flex: 1; min-width: 0; }

.cart-item-name {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-qty { font-size: 0.8rem; color: var(--text-muted); }

/* ============================================================
   ADM — Lista de pedidos por loja
   ============================================================ */

.orders-list { display: flex; flex-direction: column; gap: 0; }

.order-store-row {
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 0;
}

.order-store-row:last-child { border-bottom: none; }

.order-store-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.order-items-detail {
  margin-top: 0.625rem;
  margin-left: 52px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.order-item-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 0.2rem 0;
  color: var(--text-muted);
  border-bottom: 1px dashed var(--border);
}

.order-item-row:last-child { border-bottom: none; }

.order-item-name { font-weight: 500; color: var(--text); }
.order-item-qty  { font-weight: 600; color: var(--text-muted); white-space: nowrap; }

/* Botão voltar */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0;
  flex-shrink: 0;
}

.back-btn:hover { text-decoration: underline; }

/* ============================================================
   Linhas expansíveis — pedidos por loja
   ============================================================ */

.order-store-header.expandable {
  cursor: pointer;
  user-select: none;
}

.order-store-header.expandable:hover { background: var(--bg); }

.order-store-row {
  border-bottom: 1px solid var(--border);
}

.order-store-row:last-child { border-bottom: none; }

.order-store-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .875rem 1.25rem;
}

.expand-chevron {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  transition: transform .2s ease;
}

.expand-chevron.rotated { transform: rotate(180deg); }

.order-items-collapse {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.order-items-collapse.open { display: block; }

.order-items-body { padding: .75rem 1.25rem; }

/* Tabela de itens */
.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  margin-bottom: .25rem;
}

.items-table th {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  padding: .375rem .5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.items-table td {
  padding: .5rem;
  border-bottom: 1px dashed var(--border);
  vertical-align: middle;
}

.items-table tr:last-child td { border-bottom: none; }

.qty-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: .78rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 4px;
}

.qty-adj-input {
  padding: .3rem .5rem;
  font-size: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}

.qty-adj-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(35,151,83,.12);
}

/* Supply-in-cart com SVG inline */
.supply-in-cart svg { vertical-align: -2px; }

/* ============================================================
   Supply Request Windows — status colors & badges
   ============================================================ */
:root {
  --srw-pending:   #9e9e9e;
  --srw-submitted: #f59e0b;
  --srw-ready:     #239753;
  --srw-received:  #3b82f6;
}

.badge-srw-pending   { background: #f3f4f6;         color: #6b7280; }
.badge-srw-submitted { background: #fef3c7;         color: #92400e; }
.badge-srw-ready     { background: var(--primary-light); color: var(--primary-dark); }
.badge-srw-received  { background: #dbeafe;         color: #1e40af; }

/* ============================================================
   Leader grid (semelhante ao store-grid)
   ============================================================ */
.leader-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.leader-square {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  min-height: 64px;
  border-radius: var(--radius-sm);
  padding: .375rem .25rem;
  cursor: default;
  position: relative;
}

.leader-square[data-status="pending"]   { background: var(--srw-pending);   color: #fff; }
.leader-square[data-status="submitted"] { background: var(--srw-submitted);  color: #fff; }
.leader-square[data-status="ready"]     { background: var(--srw-ready);      color: #fff; }
.leader-square[data-status="received"]  { background: var(--srw-received);   color: #fff; }

.leader-square-name {
  font-weight: 800;
  font-size: .85rem;
  letter-spacing: .03em;
  line-height: 1;
  margin-bottom: .25rem;
}

.leader-square-status {
  font-size: .62rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  opacity: .9;
}

/* ============================================================
   Alertas de sucesso
   ============================================================ */
.alert-success {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: .625rem 1rem;
  font-size: .875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ============================================================
   Supply Request Windows — Day Grid (modal criação)
   ============================================================ */
.srw-day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .375rem;
  margin-bottom: .5rem;
}

.srw-day-label {
  display: flex;
  align-items: center;
  gap: .375rem;
  padding: .375rem .625rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .8rem;
  transition: border-color .15s, background .15s;
  user-select: none;
}

.srw-day-label:hover { border-color: var(--primary); }
.srw-day-label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

.srw-mini-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: .25rem .625rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  gap: .1rem;
}

.srw-mini-badge[data-status="open"]      { border-color: var(--primary); color: var(--primary); }
.srw-mini-badge[data-status="closed"]    { opacity: .55; }
.srw-mini-badge[data-status="cancelled"] { opacity: .4; text-decoration: line-through; }
