:root{
  --bg: #F6F2E7;
  --surface: #FFFFFF;
  --primary: #2F6B4F;
  --primary-light: #4C8F5C;
  --accent: #E07A3F;
  --danger: #B54A3F;
  --text: #26312B;
  --muted: #6B7568;
  --border: #E3E1D4;
  --radius: 10px;
}

*{ box-sizing: border-box; }
html,body{ margin:0; padding:0; }

body{
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a{ color: inherit; text-decoration: none; }

.layout{
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar{
  background: var(--primary);
  color: #EFF3EC;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand{
  font-family: 'Petrona', serif;
  font-weight: 600;
  font-style: italic;
  font-size: 22px;
  color: #fff;
  padding: 4px 10px 22px 10px;
  border-bottom: 1px dashed rgba(255,255,255,0.25);
  margin-bottom: 18px;
}
.brand span{ color: var(--accent); font-style: normal; }

.nav-group-label{
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(239,243,236,0.5);
  padding: 6px 10px;
  margin-top: 8px;
}

.nav-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 8px;
  color: rgba(239,243,236,0.85);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
}
.nav-item svg{ flex-shrink:0; opacity: .85; }
.nav-item:hover{ background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active{ background: var(--primary-light); color: #fff; }
.nav-item.active svg{ opacity: 1; }

.nav-badge{
  margin-left: auto;
  background: var(--accent);
  color: #2A1B04;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}

.sidebar-footer{
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px dashed rgba(255,255,255,0.25);
}

/* ---------- MAIN ---------- */
.main{ padding: 26px 34px 60px; }

.topbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
  flex-wrap: wrap;
  gap: 14px;
}

.topbar h1{
  font-family: 'Petrona', serif;
  font-weight: 600;
  font-size: 26px;
  margin: 0 0 4px 0;
}
.topbar .subtitle{ color: var(--muted); font-size: 13.5px; }

.topbar-right{ display:flex; align-items:center; gap: 14px; }

.search-box{
  display:flex; align-items:center; gap:8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--muted);
  width: 240px;
}
.search-box input{
  border:none; outline:none; background:transparent;
  font-family:inherit; font-size:13.5px; width:100%; color: var(--text);
}

.icon-btn{
  position: relative;
  width: 38px; height: 38px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  color: var(--text);
}
.icon-btn .dot{
  position:absolute; top:-4px; right:-4px;
  background: var(--danger); color:#fff;
  font-family:'IBM Plex Mono', monospace;
  font-size: 10px; font-weight:600;
  width:16px; height:16px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
}

.avatar{
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent);
  color: #2A1B04;
  font-weight:600;
  display:flex; align-items:center; justify-content:center;
  font-family:'IBM Plex Mono', monospace;
}

/* ---------- SHELF-TAG STAT CARDS (signature element) ---------- */
.stat-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 30px;
}

.tag-card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  padding: 16px 18px 18px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tag-card:hover{ transform: translateY(-2px); box-shadow: 0 6px 16px rgba(31,77,58,0.08); }

.tag-card::before{
  content:"";
  position:absolute;
  top: -7px; left: 18px;
  width: 14px; height: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
}

.tag-label{
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}

.tag-divider{
  border-top: 1.5px dashed var(--border);
  margin: 0 0 10px 0;
}

.tag-value{
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 26px;
  line-height: 1;
}
.tag-card.tone-accent .tag-value{ color: var(--accent); }
.tag-card.tone-danger .tag-value{ color: var(--danger); }
.tag-card.tone-primary .tag-value{ color: var(--primary); }

.tag-suffix{
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* ---------- PANELS ---------- */
.panel-grid{
  display:grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}

.panel{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.panel-header{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.panel-header h2{
  font-family: 'Petrona', serif;
  font-weight: 600;
  font-size: 17px;
  margin: 0;
}
.panel-header a{
  font-size: 12.5px;
  color: var(--primary);
  font-weight: 500;
}

table{ width:100%; border-collapse: collapse; }
th{
  text-align:left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}
td{
  padding: 10px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}
tr:last-child td{ border-bottom:none; }

.sku{ font-family:'IBM Plex Mono', monospace; color: var(--muted); font-size: 12px; }

.pill{
  display:inline-block;
  font-family:'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
}
.pill.zero{ background: rgba(181,74,63,0.12); color: var(--danger); }
.pill.low{ background: rgba(217,142,43,0.14); color: var(--accent); }
.pill.ok{ background: rgba(47,107,79,0.12); color: var(--primary); }

.activity-item{
  display:flex; align-items:flex-start; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.activity-item:last-child{ border-bottom:none; }

.activity-dot{
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 5px; flex-shrink:0;
}
.activity-dot.in{ background: var(--primary-light); }
.activity-dot.out{ background: var(--danger); }

.activity-qty{
  font-family:'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 13px;
}
.activity-item.in .activity-qty{ color: var(--primary); }
.activity-item.out .activity-qty{ color: var(--danger); }

.activity-when{ font-size: 12px; color: var(--muted); }

/* ---------- BUTTONS ---------- */
.btn{
  display:inline-flex; align-items:center; gap:6px;
  font-family:'IBM Plex Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, transform .1s ease, border-color .15s ease;
}
.btn:hover{ background: var(--bg); }
.btn:active{ transform: translateY(1px); }

/* Updated Yellow Primary Button */
.btn-primary{
  background: #facc15;       /* Warm, vibrant yellow */
  border-color: #eab308;     /* Slightly deeper border for definition */
  color: #111827;            /* Dark charcoal text for high contrast */
  font-weight: 600;          /* Slightly heavier font weight aids legibility */
}
.btn-primary:hover,
a.btn-primary:hover{
  background: #eab308;       /* Darker yellow on hover */
  border-color: #ca8a04;
  color: #111827 !important; /* Keep dark text on hover */
}
.btn-primary:active{
  background: #ca8a04;       /* Deep yellow on click */
}

.btn-danger{
  background: var(--surface);
  border-color: var(--light);
  color: var(--danger);
}
.btn-danger:hover{ background: rgba(181,74,63,0.1); }

.btn-sm{ padding: 6px 11px; font-size: 12.5px; }

.action-row{ display:flex; gap:8px; }
/* ---------- FORMS / MODAL ---------- */
.modal-overlay{
  display:none;
  position:fixed; inset:0;
  background: rgba(30,42,34,0.45);
  align-items:center; justify-content:center;
  z-index: 50;
  padding: 20px;
}
.modal-overlay.open{ display:flex; }

.modal{
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  padding: 24px 26px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2{
  font-family:'Petrona', serif;
  font-weight:600;
  font-size: 19px;
  margin: 0 0 18px 0;
}

.form-group{ margin-bottom: 14px; }
.form-row{ display:flex; gap: 12px; }
.form-row .form-group{ flex:1; }

.form-group label{
  display:block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 500;
}

.form-group input,
.form-group select{
  width:100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family:'IBM Plex Sans', sans-serif;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
}
.form-group input:focus,
.form-group select:focus{
  outline: 2px solid var(--primary-light);
  outline-offset: 1px;
}

.modal-actions{
  display:flex; justify-content:flex-end; gap: 10px;
  margin-top: 20px;
}

.flash{
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.flash.success{ background: rgba(47,107,79,0.1); color: var(--primary); border-color: rgba(47,107,79,0.25); }
.flash.error{ background: rgba(181,74,63,0.1); color: var(--danger); border-color: rgba(181,74,63,0.25); }

.empty-state{
  text-align:center;
  padding: 40px 20px;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce){
  .tag-card{ transition: none; }
}

@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  .sidebar{ position: relative; height:auto; }
  .stat-grid{ grid-template-columns: repeat(2,1fr); }
  .panel-grid{ grid-template-columns: 1fr; }
  .form-row{ flex-direction: column; gap: 0; }
}