/* The History home keeps product names and server labels on separate lines. */
.history-home { background: var(--surface-2); }
.history-header { padding-top: 20px; }
.history-eyebrow { display: block; color: var(--accent-text); font-size: .875rem; font-weight: 700; margin-bottom: 8px; }
.history-header .h-display { font-size: 2rem; line-height: 1.15; letter-spacing: -.04em; }
.history-header p { margin: 10px 0 0; font-size: .9375rem; color: var(--text-2); }
.history-shortcuts { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,8rem),1fr)); gap: 10px; margin-top: 24px; }
.history-shortcut { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); text-decoration: none; min-width: 0; overflow-wrap: anywhere; }
.history-shortcut-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 8px; }
.history-shortcut-icon svg { width: 20px; height: 20px; }
.history-shortcut b { font-size: .9375rem; line-height: 1.4; }
.history-shortcut > span:last-child { font-size: .875rem; color: var(--text-2); }
.history-home .search .field { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.history-home .chips { position: relative; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; padding: 4px 2px 8px; gap: 8px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.history-home .chip { flex: none; font-size: .875rem; padding: 10px 14px; background: var(--surface); }
.history-home .chip.selected { background: var(--text); color: var(--bg); border-color: var(--text); }
.history-home .day-label { margin: 20px 0 10px; font-size: .875rem; }
.history-entry { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 12px; margin-bottom: 10px; }
.history-item { display: flex; align-items: flex-start; gap: 4px; }
.history-item .history-row { flex: 1; min-width: 0; gap: 12px; align-items: flex-start; padding: 2px 0; }
.history-item .history-row .name { overflow-wrap: anywhere; font-size: 1rem; line-height: 1.4; font-weight: 700; }
.history-item .history-row .time { font-size: .875rem; }
.history-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.history-item .thumb { width: 48px; height: 56px; border-radius: 12px; background: var(--thumb); }
.history-item .thumb img { object-fit: contain; }
.history-item .tag { font-size: .8125rem; padding: 3px 9px; min-height: 0; line-height: 1.4; }
.history-fav { color: var(--text-3); width: 44px; height: 44px; }
.history-fav svg { width: 20px; height: 20px; }
.history-fav[aria-pressed="true"] { color: #F59E0B; }
.history-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: calc(100% - 60px); margin: 6px 0 0 60px; padding-top: 2px; border-top: 1px solid var(--line); }
.history-ate { display: flex; align-items: center; justify-content: flex-end; min-height: 40px; margin-left: auto; padding: 0 4px; background: transparent; color: var(--accent-text); font-weight: 700; font-size: .875rem; cursor: pointer; }
.history-forget { min-height: 40px; padding: 0 4px; background: transparent; color: var(--text-2); font-size: .875rem; font-weight: 600; }
.history-undo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.history-ate:focus-visible,.history-shortcut:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
.history-home .empty { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; margin-top: 16px; padding: 28px 20px; }
/* Larger text gets the whole card width instead of a narrow column beside the photo. */
.history-entry { container-type: inline-size; }
@container (max-width: 14rem) {
  .history-item { display: block; position: relative; }
  .history-item .history-row { display: grid; grid-template-columns: 48px minmax(0,1fr); }
  .history-item .history-row .grow { grid-column: 1 / -1; }
  .history-item .history-fav { position: absolute; right: 0; top: 0; }
  .history-actions { margin-left: 0; width: 100%; }
}
.history-home .chip { max-width: none; white-space: nowrap; }

.history-home .search .field { padding-right:48px; }
.history-home .history-clear { position:absolute; right:4px; top:50%; transform:translateY(-50%); width:44px; height:44px; }
.history-home .history-clear svg { position:static; transform:none; width:18px; height:18px; }
.history-home .history-clear[hidden] { display:none; }
.history-home .search input::-webkit-search-cancel-button { display:none; }

.history-undo { flex-wrap:wrap; }
.history-undo>span { min-width:0; flex:1 1 10rem; overflow-wrap:anywhere; font-size:.875rem; }
.history-undo button { min-width:44px; min-height:44px; padding:8px; font-size:.875rem; }
.history-shortcut .history-glance { font-size: .875rem; font-weight: 700; color: var(--text); }
.history-shortcut .history-glance-over { color: var(--danger-text); }
.history-shortcut .history-glance-near { color: var(--warn-text); }
.history-glance-bar { display: block; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.history-glance-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.history-glance-bar.history-glance-over > span { background: var(--danger-icon); }
.history-glance-bar.history-glance-near > span { background: var(--warn-text); }
.history-glance-bar.history-glance-ok > span { background: var(--ok-text); }
.history-shortcut [data-day-glance]:not(.history-glance) { font-size: .875rem; color: var(--text-2); }
