.history-overlay{
  position:fixed;inset:0;z-index:100;
  background:rgba(45,26,16,.42);
  backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);
  display:flex;align-items:center;justify-content:center;padding:24px;
  animation:fadeIn .3s ease;
}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.history-panel{
  width:min(560px, 92vw);max-height:82vh;
  background:var(--milk);
  border:1px solid var(--gold-soft);
  box-shadow:
    0 30px 70px rgba(45,26,16,.35),
    0 4px 14px rgba(45,26,16,.12),
    inset 0 0 0 1px #fffefb,
    inset 0 0 0 2px var(--gold-faint);
  border-radius:3px;display:flex;flex-direction:column;overflow:hidden;
  animation:slideUp .38s cubic-bezier(.4,0,.2,1);
}
@keyframes slideUp{from{transform:translateY(24px);opacity:0}to{transform:translateY(0);opacity:1}}
.history-header{
  padding:24px 28px 20px;
  border-bottom:1px solid var(--gold-faint);
  display:flex;align-items:center;justify-content:space-between;
  flex-shrink:0;position:relative;
}
.history-title{
  font-size:17px;letter-spacing:.36em;color:var(--ink);
  font-weight:500;text-indent:.36em;
}
.history-close{
  min-width:0!important;width:32px!important;height:32px!important;
  padding:0!important;margin:0!important;
  font-size:16px!important;letter-spacing:0!important;line-height:1!important;
  border-radius:50%!important;
  display:flex!important;align-items:center;justify-content:center;
  color:var(--ink-3)!important;background:transparent!important;
  border:1px solid var(--gold-faint)!important;
  box-shadow:none!important;text-shadow:none!important;
  opacity:.75;transition:all .3s ease;transform:none!important;
}
.history-close:hover{
  opacity:1;color:#fffaf0!important;
  background:linear-gradient(180deg,#e3c98b 0%,#a8873f 100%)!important;
  border-color:var(--gold-dk)!important;
  box-shadow:0 4px 10px rgba(138,106,63,.3)!important;
}
.history-stats{
  padding:20px 28px 22px;
  background:linear-gradient(180deg, rgba(201,169,97,.07), rgba(201,169,97,.02));
  border-bottom:1px solid var(--gold-faint);
  flex-shrink:0;position:relative;
}
.history-stats.hidden{display:none !important;}
.stats-title{
  font-size:10px;letter-spacing:.5em;color:var(--ink-3);text-indent:.5em;
  margin-bottom:14px;display:flex;align-items:center;gap:12px;opacity:.8;
}
.stats-title::before,.stats-title::after{
  content:"";flex:1;height:1px;
  background:linear-gradient(90deg, transparent, var(--gold-faint), transparent);
}
.stats-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px 22px;}
.stats-row{display:flex;align-items:baseline;gap:8px;min-width:0;}
.stats-label{color:var(--ink-3);font-size:10px;letter-spacing:.28em;flex-shrink:0;opacity:.85;}
.stats-value{
  color:var(--ink);font-size:14px;font-weight:500;letter-spacing:.16em;
  flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.stats-count{
  color:var(--gold-dk);font-size:11px;letter-spacing:.04em;
  font-weight:500;flex-shrink:0;font-family:"Noto Serif SC", serif;
}
.stats-count::before{content:"×";margin-right:1px;opacity:.7;font-size:10px;}

.history-body{
  flex:1;overflow-y:auto;padding:8px 8px;
  scrollbar-width:thin;scrollbar-color:rgba(184,147,90,.35) transparent;
}
.history-body::-webkit-scrollbar{width:6px;}
.history-body::-webkit-scrollbar-track{background:transparent;}
.history-body::-webkit-scrollbar-thumb{
  background:rgba(184,147,90,.3);border-radius:3px;
}
.history-body::-webkit-scrollbar-thumb:hover{background:rgba(184,147,90,.5);}
.history-empty{
  text-align:center;padding:70px 20px;
  color:var(--ink-3);font-size:14px;
  letter-spacing:.26em;text-indent:.26em;opacity:.7;line-height:2;
}
.history-item{
  padding:18px 46px 18px 22px;margin:2px 0;border-radius:2px;
  transition:background .3s ease, opacity .3s ease, transform .3s ease;
  position:relative;
}
.history-item:hover{
  background:linear-gradient(90deg, rgba(201,169,97,.07), rgba(201,169,97,.02));
}
.history-item::after{
  content:"";position:absolute;bottom:0;left:22px;right:22px;height:1px;
  background:linear-gradient(90deg, transparent, var(--gold-faint), transparent);
}
.history-item:last-child::after{display:none;}
.history-delete{
  position:absolute !important;
  top:14px !important;right:14px !important;
  width:26px !important;height:26px !important;
  min-width:0 !important;min-height:0 !important;
  padding:0 !important;margin:0 !important;
  border-radius:50% !important;
  font-family:inherit !important;
  font-size:13px !important;font-weight:400 !important;
  letter-spacing:0 !important;line-height:1 !important;
  display:flex !important;align-items:center;justify-content:center;
  color:var(--ink-3) !important;background:transparent !important;
  border:1px solid transparent !important;
  box-shadow:none !important;text-shadow:none !important;
  transform:none !important;opacity:0;
  transition:all .28s ease;cursor:pointer;
}
.history-item:hover .history-delete{opacity:.55;}
.history-delete:hover{
  opacity:1 !important;color:#fffaf0 !important;
  background:linear-gradient(180deg,#e3c98b 0%,#a8873f 100%) !important;
  border-color:var(--gold-dk) !important;
  box-shadow:0 4px 10px rgba(138,106,63,.3) !important;
}
.history-time{
  font-size:11px;color:var(--ink-3);letter-spacing:.22em;
  margin-bottom:10px;opacity:.75;display:flex;align-items:center;gap:10px;
}
.history-time::before{
  content:"";display:inline-block;width:5px;height:5px;
  transform:rotate(45deg);background:var(--gold);opacity:.55;
}
.history-fields{
  display:flex;flex-wrap:wrap;align-items:center;
  font-size:15px;color:var(--ink);letter-spacing:.14em;line-height:1.9;
}
.history-tag{font-weight:500;text-indent:.14em;}
.history-dot{color:var(--gold);margin:0 8px;font-weight:300;font-size:13px;opacity:.85;}

.history-footer{
  padding:16px 26px;border-top:1px solid var(--gold-faint);
  display:flex;align-items:center;justify-content:space-between;flex-shrink:0;
}
.history-count{font-size:12px;color:var(--ink-3);letter-spacing:.24em;}
.history-count strong{font-weight:500;color:var(--gold-dk);font-size:13px;}
.history-clear{
  min-width:0!important;padding:8px 18px!important;margin:0!important;
  font-size:12px!important;font-weight:400!important;
  letter-spacing:.32em!important;text-indent:.32em;
  color:var(--ink-3)!important;background:transparent!important;
  border:1px solid var(--gold-faint)!important;
  box-shadow:none!important;text-shadow:none!important;
  opacity:.8;transition:all .3s ease;transform:none!important;
}
.history-clear:hover{
  opacity:1;color:#fffaf0!important;
  background:linear-gradient(180deg,#e3c98b 0%,#a8873f 100%)!important;
  border-color:var(--gold-dk)!important;
  box-shadow:0 4px 10px rgba(138,106,63,.28)!important;
}
.history-item.removing{opacity:0;transform:translateX(16px);}
