.history-main {
    width: min(100%, 960px);
    max-width: 100%;
    padding: calc(16px + var(--safe-top)) 12px calc(80px + var(--safe-bottom));
}

.history-screen {
    position: relative;
    display: grid;
    gap: 16px;
    min-height: var(--app-stable-height, 100vh);
}

.history-screen::before,
.history-screen::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

.history-screen::before {
    background:
        radial-gradient(circle at 18% 12%, rgba(148, 28, 41, 0.18), transparent 24%),
        radial-gradient(circle at 82% 18%, rgba(216, 167, 95, 0.06), transparent 20%),
        radial-gradient(circle at 50% 72%, rgba(126, 19, 31, 0.14), transparent 28%);
}

.history-screen::after {
    background-image:
        radial-gradient(circle at 14% 18%, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px),
        radial-gradient(circle at 76% 32%, rgba(216, 167, 95, 0.14) 0 1px, transparent 1px),
        radial-gradient(circle at 58% 84%, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px);
    background-size: 180px 180px, 240px 260px, 300px 300px;
    opacity: 0.18;
    mask-image: linear-gradient(180deg, #000, transparent 88%);
}

/* ═══════════════════════════════════════════════════════
   HISTORY HERO  —  Reference-matched first block
   ═══════════════════════════════════════════════════════ */

.history-hero,
.history-shell {
    position: relative;
    overflow: visible;
    border: 1px solid rgba(211, 124, 75, 0.14);
    border-radius: 30px;
    background:
        linear-gradient(155deg, rgba(20, 16, 16, 0.88), rgba(8, 7, 7, 0.97)),
        rgba(255, 255, 255, 0.025);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 28px 90px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(20px);
}

.history-hero::before,
.history-shell::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.03);
    pointer-events: none;
    z-index: 0;
}

/* ── Hero layout ─────────────────────────────────────── */
.history-hero {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 16px 16px 20px;
}

/* ── Top navigation bar ──────────────────────────────── */
.history-hero__nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    position: relative;
    z-index: 2;
}

.history-hero__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.045);
    color: rgba(248, 235, 225, 0.86);
    text-decoration: none;
    transition: background 0.18s, border-color 0.18s;
}

.history-hero__back:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(200, 48, 58, 0.3);
}

.history-hero__eyebrow {
    flex: 1;
    color: #c8303a;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    line-height: 1;
}

.history-hero__counter {
    flex: 0 0 auto;
    color: rgba(255, 243, 235, 0.92);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    min-width: 20px;
    text-align: right;
}

/* ── Segmented progress track ────────────────────────── */
.history-hero__track {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 14px;
    padding: 0 4px;
    position: relative;
    z-index: 2;
}

.history-hero__seg {
    flex: 1;
    height: 2px;
    border-radius: 1px;
}

.history-hero__seg--active {
    background: linear-gradient(90deg, #c8303a, #d44a52);
    box-shadow: 0 0 6px rgba(200, 48, 58, 0.45);
}

.history-hero__seg--mid {
    background: rgba(200, 48, 58, 0.36);
}

.history-hero__seg--dim {
    background: rgba(200, 48, 58, 0.14);
}

.history-hero__node {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 0 1px;
}

.history-hero__node--amber {
    background: radial-gradient(circle at 40% 35%, #f0a050, #d07028);
    box-shadow: 0 0 10px rgba(210, 120, 40, 0.65);
}

.history-hero__node--red {
    background: radial-gradient(circle at 40% 35%, #e04850, #b82030);
    box-shadow: 0 0 10px rgba(184, 32, 48, 0.55);
}

/* ── Cinematic hero cover ────────────────────────────── */
.history-hero__cover {
    position: relative;
    width: calc(100% + 32px);
    margin-left: -16px;
    height: 220px;
    overflow: hidden;
    background:
        radial-gradient(ellipse 80% 60% at 50% 110%, rgba(215, 140, 28, 0.52) 0%, transparent 55%),
        radial-gradient(ellipse 60% 45% at 52% 95%, rgba(185, 90, 18, 0.32) 0%, transparent 48%),
        radial-gradient(ellipse 100% 50% at 50% 75%, rgba(148, 28, 41, 0.22) 0%, transparent 60%),
        radial-gradient(ellipse 70% 40% at 48% 45%, rgba(100, 18, 28, 0.18) 0%, transparent 50%),
        linear-gradient(180deg, #090707 0%, #140d06 45%, #0d0803 75%, #100907 100%);
    flex-shrink: 0;
}

.history-hero__cover-vignette {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(9,7,7,0.55) 0%, transparent 25%, transparent 70%, rgba(9,7,7,0.72) 100%),
        linear-gradient(90deg, rgba(9,7,7,0.3) 0%, transparent 15%, transparent 85%, rgba(9,7,7,0.3) 100%);
    z-index: 3;
    pointer-events: none;
}

.history-hero__cover-path {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 72px;
    height: 210px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(215, 148, 32, 0.06) 20%,
        rgba(215, 148, 32, 0.22) 55%,
        rgba(215, 148, 32, 0.48) 80%,
        rgba(215, 148, 32, 0.62) 100%
    );
    clip-path: polygon(38% 0%, 62% 0%, 100% 100%, 0% 100%);
    z-index: 1;
}

.history-hero__cover-glow {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    height: 90px;
    background: radial-gradient(ellipse, rgba(215, 148, 32, 0.56) 0%, rgba(215, 120, 22, 0.22) 45%, transparent 70%);
    border-radius: 50%;
    z-index: 2;
    animation: heroGlowPulse 3.2s ease-in-out infinite;
}

.history-hero__cover-sparks {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.history-hero__cover-sparks i {
    position: absolute;
    border-radius: 50%;
    background: rgba(215, 165, 60, 0.9);
    animation: sparkFloat var(--dur, 4s) ease-in-out infinite var(--delay, 0s);
    opacity: 0;
}

.history-hero__cover-sparks i:nth-child(1)  { left: 48%; bottom: 15%; width: 3px; height: 3px; --dur: 3.8s; --delay: 0s;   --dx: -5px; }
.history-hero__cover-sparks i:nth-child(2)  { left: 52%; bottom: 28%; width: 2px; height: 2px; --dur: 4.4s; --delay: 0.6s; --dx: 6px;  }
.history-hero__cover-sparks i:nth-child(3)  { left: 44%; bottom: 22%; width: 2px; height: 2px; --dur: 5.2s; --delay: 1.1s; --dx: -9px; }
.history-hero__cover-sparks i:nth-child(4)  { left: 56%; bottom: 18%; width: 3px; height: 3px; --dur: 3.6s; --delay: 1.8s; --dx: 8px;  }
.history-hero__cover-sparks i:nth-child(5)  { left: 50%; bottom: 38%; width: 2px; height: 2px; --dur: 6.0s; --delay: 0.4s; --dx: -4px; }
.history-hero__cover-sparks i:nth-child(6)  { left: 46%; bottom: 44%; width: 2px; height: 2px; background: rgba(255,200,100,0.7); --dur: 4.8s; --delay: 2.2s; --dx: -7px; }
.history-hero__cover-sparks i:nth-child(7)  { left: 54%; bottom: 52%; width: 2px; height: 2px; background: rgba(255,200,100,0.6); --dur: 5.6s; --delay: 1.5s; --dx: 7px;  }
.history-hero__cover-sparks i:nth-child(8)  { left: 42%; bottom: 35%; width: 3px; height: 3px; --dur: 4.2s; --delay: 3.0s; --dx: -11px;}
.history-hero__cover-sparks i:nth-child(9)  { left: 58%; bottom: 42%; width: 2px; height: 2px; --dur: 5.0s; --delay: 0.9s; --dx: 10px; }
.history-hero__cover-sparks i:nth-child(10) { left: 50%; bottom: 62%; width: 2px; height: 2px; background: rgba(255,210,130,0.5); --dur: 6.4s; --delay: 2.6s; --dx: -3px; }

.history-hero__cover-silhouette {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 88px;
    z-index: 4;
    background:
        radial-gradient(ellipse 55% 18% at 50% 6%, #1a1208 60%, transparent 100%),
        linear-gradient(180deg, #1a1208 0%, #0d0904 100%);
    clip-path: polygon(
        38% 0%,
        62% 0%,
        72% 8%,
        68% 22%,
        76% 36%,
        80% 55%,
        100% 100%,
        0% 100%,
        20% 55%,
        24% 36%,
        32% 22%,
        28% 8%
    );
    opacity: 0.82;
    filter: drop-shadow(0 -4px 10px rgba(0,0,0,0.6));
}

/* ── Pagination dots ─────────────────────────────────── */
.history-hero__dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px 12px;
    position: relative;
    z-index: 2;
}

.history-hero__dots span {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(148, 28, 41, 0.65);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.history-hero__dots span.is-active {
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    background: radial-gradient(circle at 38% 35%, #e04050, #b82030 70%);
    box-shadow:
        0 0 0 2px rgba(184, 32, 48, 0.22),
        0 0 16px rgba(200, 48, 64, 0.65),
        0 0 32px rgba(200, 48, 64, 0.28);
}

/* ── Hero body (copy + stats) ────────────────────────── */
.history-hero__body {
    display: grid;
    gap: 14px;
    padding-top: 4px;
    position: relative;
    z-index: 2;
}

.history-hero__copy {
    display: grid;
    gap: 8px;
}

.history-kicker {
    color: rgba(216, 167, 95, 0.78);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.history-hero h1,
.history-section-head h2,
.history-important h2,
.history-empty h2 {
    margin: 0;
    color: #fff3eb;
    font-family: "Cormorant Garamond", serif;
    font-weight: 600;
    letter-spacing: 0;
}

.history-hero h1 {
    font-size: clamp(26px, 7vw, 38px);
    line-height: 1.02;
    max-width: 24ch;
}

.history-hero__copy p {
    margin: 0;
    color: rgba(250, 235, 224, 0.68);
    font-size: 14px;
    line-height: 1.56;
}

.history-hero__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.history-hero__stat {
    display: grid;
    gap: 3px;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.04);
}

.history-hero__stat strong {
    color: #fff3eb;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-hero__stat span {
    color: rgba(244, 226, 214, 0.52);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

/* ── Keyframes ───────────────────────────────────────── */
@keyframes heroGlowPulse {
    0%, 100% { opacity: 0.75; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.12); }
}

@keyframes sparkFloat {
    0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
    15% { opacity: 0.9; }
    60% { opacity: 0.7; transform: translate(calc(var(--dx, -8px)), -40px) scale(1); }
    100% { opacity: 0; transform: translate(calc(var(--dx, -8px) * 1.5), -80px) scale(0.4); }
}

/* ═══════════════════════════════════════════════════════
   COMPACT NAV  —  replaces hero block
   ═══════════════════════════════════════════════════════ */

.history-compact-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 2px 0 6px;
    position: relative;
    z-index: 2;
}

.history-compact-nav__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.045);
    color: rgba(248, 235, 225, 0.86);
    text-decoration: none;
    transition: background 0.18s, border-color 0.18s;
}

.history-compact-nav__back:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(200, 48, 58, 0.3);
}

.history-compact-nav__title {
    flex: 1;
    min-width: 0;
}

.history-compact-nav__title span {
    display: block;
    color: #c8303a;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-compact-nav__count {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid rgba(200, 48, 58, 0.2);
    background: rgba(200, 48, 58, 0.08);
    color: rgba(255, 243, 235, 0.86);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════════════
   AJAX LOADING STATE
   ═══════════════════════════════════════════════════════ */

#history-results {
    position: relative;
    transition: opacity 0.18s ease;
}

#history-results.is-loading {
    opacity: 0.45;
    pointer-events: none;
}

#history-results.is-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(200, 48, 58, 0.18);
    border-top-color: #c8303a;
    animation: historySpinner 0.7s linear infinite;
    z-index: 10;
    margin-top: 24px;
}

@keyframes historySpinner {
    to { transform: translateX(-50%) rotate(360deg); }
}

/* ───────────────────────────────────────────────────── */

.history-shell {
    padding: 18px;
    display: grid;
    gap: 18px;
}

.history-shell__ambient span {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.history-shell__ambient span:nth-child(1) {
    inset: -40px auto auto 12%;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(132, 23, 34, 0.2), transparent 70%);
    animation: historyOrb 12s ease-in-out infinite;
}

.history-shell__ambient span:nth-child(2) {
    inset: 20% 8% auto auto;
    width: 4px;
    height: 4px;
    background: rgba(216, 167, 95, 0.8);
    box-shadow: 0 0 12px rgba(216, 167, 95, 0.28);
    animation: historyDust 8s ease-in-out infinite;
}

.history-shell__ambient span:nth-child(3) {
    inset: auto 16% 12% auto;
    width: 3px;
    height: 3px;
    background: rgba(255, 238, 225, 0.6);
    box-shadow: 0 0 10px rgba(184, 44, 54, 0.24);
    animation: historyDust 11s ease-in-out infinite -3s;
}

.history-shell__ambient span:nth-child(4) {
    inset: auto auto 10% 18%;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(216, 167, 95, 0.06), transparent 70%);
    animation: historyOrb 18s ease-in-out infinite -6s;
}

.history-saved-toggle,
.history-card__actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid rgba(211, 124, 75, 0.18);
    background:
        linear-gradient(180deg, rgba(120, 22, 34, 0.94), rgba(86, 16, 27, 0.98)),
        rgba(255, 255, 255, 0.03);
    color: #fff4eb;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 16px 36px rgba(84, 13, 22, 0.26);
}

.history-saved-toggle {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: rgba(250, 235, 224, 0.46);
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
}

.history-saved-toggle:hover {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(250, 235, 224, 0.72);
}

.history-saved-toggle.is-active {
    border-color: rgba(216, 167, 95, 0.32);
    color: #ffd99d;
    background: linear-gradient(145deg, rgba(82, 18, 28, 0.88), rgba(46, 13, 18, 0.96));
    box-shadow:
        0 0 0 1px rgba(216, 167, 95, 0.08) inset,
        0 0 18px rgba(216, 167, 95, 0.14);
}

.history-saved-toggle.is-active svg {
    fill: #ffd99d;
    stroke: #ffd99d;
}

.history-saved-toggle.is-active {
    border-color: rgba(216, 167, 95, 0.24);
    color: #fff1df;
    background:
        linear-gradient(180deg, rgba(82, 18, 28, 0.94), rgba(46, 13, 18, 0.98)),
        rgba(255, 255, 255, 0.03);
}

.history-filters {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.history-pill {
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(244, 226, 214, 0.66);
    font-size: 12px;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    white-space: nowrap;
    transition: border-color 0.18s, color 0.18s, background 0.18s;
}

.history-pill:hover {
    border-color: rgba(255, 255, 255, 0.14);
    color: rgba(244, 226, 214, 0.88);
}

.history-pill.is-active {
    border-color: rgba(216, 167, 95, 0.22);
    color: #fff1df;
    box-shadow: 0 0 0 1px rgba(216, 167, 95, 0.06) inset;
}

.history-retention {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 6px;
    padding: 15px 16px;
    border: 1px solid rgba(211, 124, 75, 0.12);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.025);
}

.history-retention span {
    color: rgba(216, 167, 95, 0.82);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.history-retention p {
    margin: 0;
    color: rgba(248, 235, 224, 0.74);
    font-size: 14px;
    line-height: 1.5;
}

.history-important,
.history-group {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 12px;
}

.history-section-head {
    display: grid;
    gap: 4px;
}

.history-section-head h2,
.history-important h2 {
    font-size: clamp(28px, 8vw, 40px);
    line-height: 0.98;
}

.history-important__grid,
.history-group__list {
    display: grid;
    gap: 12px;
}

.history-timeline {
    position: relative;
    display: grid;
    gap: 18px;
}

.history-timeline::before {
    content: "";
    position: absolute;
    left: 11px;
    top: 12px;
    bottom: 12px;
    width: 1px;
    background: linear-gradient(180deg, rgba(216, 167, 95, 0.44), rgba(181, 56, 63, 0.08));
}

.history-group__label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 4px;
}

.history-group__label span {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(216, 167, 95, 0.4);
    background: radial-gradient(circle, rgba(216, 167, 95, 0.94), rgba(181, 56, 63, 0.22) 62%, transparent 76%);
    box-shadow: 0 0 14px rgba(216, 167, 95, 0.2);
}

.history-group__label strong {
    color: rgba(255, 241, 232, 0.86);
    font-size: 14px;
}

.history-card {
    position: relative;
    margin-left: 28px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.012)),
        rgba(10, 9, 9, 0.82);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 18px 42px rgba(0, 0, 0, 0.24);
}

.history-card--important {
    margin-left: 0;
    border-color: rgba(216, 167, 95, 0.16);
}

.history-card__node {
    position: absolute;
    left: -25px;
    top: 22px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1px solid rgba(216, 167, 95, 0.46);
    background: radial-gradient(circle, rgba(255, 236, 209, 0.92), rgba(216, 167, 95, 0.42) 58%, transparent 74%);
    box-shadow: 0 0 18px rgba(216, 167, 95, 0.2);
}

.history-card__head,
.history-card__footer,
.history-card__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.history-card__head > div:first-child {
    display: grid;
    gap: 3px;
}

.history-card__head span {
    color: rgba(216, 167, 95, 0.76);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.history-card__head strong {
    color: rgba(244, 226, 214, 0.56);
    font-size: 12px;
    font-weight: 500;
}

.history-card__badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.history-card__badges i,
.history-card__badges mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-style: normal;
    font-size: 11px;
}

.history-card__badges i {
    color: #fff1df;
    border: 1px solid rgba(216, 167, 95, 0.2);
    background: rgba(216, 167, 95, 0.06);
}

.history-card__badges mark {
    color: rgba(244, 226, 214, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.history-card__body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    margin-top: 14px;
}

.history-card__icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 16px;
    color: #fff1df;
    border: 1px solid rgba(216, 167, 95, 0.18);
    background:
        radial-gradient(circle at 50% 30%, rgba(255, 234, 212, 0.12), transparent 26%),
        linear-gradient(145deg, rgba(118, 20, 31, 0.92), rgba(18, 14, 14, 0.96));
    box-shadow: 0 0 24px rgba(132, 25, 37, 0.18);
}

.history-card__icon-image {
    width: 28px;
    height: 28px;
    display: block;
    object-fit: contain;
}

.history-card__copy {
    display: grid;
    gap: 7px;
}

.history-card__copy h3,
.history-important h3 {
    margin: 0;
    color: #fff3eb;
    font-family: "Cormorant Garamond", serif;
    font-size: 30px;
    line-height: 0.96;
}

.history-card__copy p,
.history-important p,
.history-empty p {
    margin: 0;
    color: rgba(248, 235, 224, 0.68);
    font-size: 14px;
    line-height: 1.56;
}

.history-card__footer {
    margin-top: 14px;
}

.history-card__footer em {
    color: rgba(244, 226, 214, 0.58);
    font-size: 12px;
    font-style: normal;
}

.history-card__actions {
    justify-content: flex-end;
}

.history-favorite {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(244, 226, 214, 0.56);
}

.history-favorite.is-active {
    border-color: rgba(216, 167, 95, 0.22);
    color: #ffd99d;
    box-shadow: 0 0 0 1px rgba(216, 167, 95, 0.06) inset;
}

.history-empty {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 24px 18px;
    text-align: center;
}

.history-empty__orb {
    position: relative;
    width: 114px;
    height: 114px;
    border-radius: 50%;
    border: 1px solid rgba(216, 167, 95, 0.22);
    background:
        radial-gradient(circle at 50% 34%, rgba(255, 234, 212, 0.12), transparent 24%),
        linear-gradient(145deg, rgba(118, 20, 31, 0.9), rgba(15, 12, 12, 0.98));
    box-shadow:
        0 0 36px rgba(132, 25, 37, 0.26),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.history-empty__orb span {
    position: absolute;
    inset: 50%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.history-empty__orb span:nth-child(1) {
    width: 72px;
    height: 72px;
    border: 1px solid rgba(216, 167, 95, 0.26);
}

.history-empty__orb span:nth-child(2) {
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, rgba(255, 236, 209, 0.92), rgba(216, 167, 95, 0.44) 58%, transparent 74%);
    box-shadow: 0 0 16px rgba(216, 167, 95, 0.24);
}

.history-empty__orb span:nth-child(3) {
    width: 92px;
    height: 92px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.history-empty__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 18px;
    border-radius: 18px;
    border: 1px solid rgba(211, 124, 75, 0.18);
    background:
        linear-gradient(180deg, rgba(120, 22, 34, 0.94), rgba(86, 16, 27, 0.98)),
        rgba(255, 255, 255, 0.03);
    color: #fff4eb;
    font-weight: 700;
    text-decoration: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 16px 36px rgba(84, 13, 22, 0.26);
}

@keyframes historyOrb {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.72; }
    50% { transform: translate3d(0, 10px, 0) scale(1.06); opacity: 1; }
}

@keyframes historyDust {
    0%, 100% { transform: translate3d(0, 0, 0); opacity: 0.28; }
    50% { transform: translate3d(0, -8px, 0); opacity: 0.86; }
}

@media (max-width: 640px) {
    .history-shell {
        border-radius: 24px;
    }

    .history-card__head {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-card__footer {
        flex-wrap: wrap;
        gap: 8px;
    }

    .history-card__actions {
        width: 100%;
        justify-content: space-between;
    }

    .history-card__actions a {
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .history-shell__ambient span,
    .history-empty__orb,
    .history-favorite,
    .history-card__node,
    .history-hero__cover-glow,
    .history-hero__cover-sparks i {
        animation: none !important;
        opacity: 1 !important;
    }
}

/* Mobile-native history archive */
body[data-page="history"] .history-screen {
    gap: 12px;
}

body[data-page="history"] .history-shell,
body[data-page="history"] .history-retention,
body[data-page="history"] .history-important,
body[data-page="history"] .history-group,
body[data-page="history"] .history-empty {
    border-radius: 28px;
}

body[data-page="history"] .history-shell {
    padding: 16px;
    gap: 14px;
}

body[data-page="history"] .history-saved-toggle,
body[data-page="history"] .history-card__actions a {
    min-height: 48px;
    border-radius: 14px;
}

body[data-page="history"] .history-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

body[data-page="history"] .history-filters::-webkit-scrollbar {
    display: none;
}

body[data-page="history"] .history-pill {
    flex: 0 0 auto;
}

body[data-page="history"] .history-important,
body[data-page="history"] .history-group {
    gap: 14px;
}

body[data-page="history"] .history-important__grid,
body[data-page="history"] .history-group__list {
    gap: 12px;
}

body[data-page="history"] .history-card {
    padding: 14px;
    border-radius: 20px;
}

body[data-page="history"] .history-card__body {
    grid-template-columns: 44px 1fr;
    gap: 12px;
}

body[data-page="history"] .history-card__copy h3,
body[data-page="history"] .history-important h3 {
    font-size: 18px;
}

body[data-page="history"] .history-card__actions {
    display: flex;
    gap: 8px;
}

body[data-page="history"] .history-card__actions a {
    flex: 1;
}


/* ─── Pagination ──────────────────────────────────────── */

.history-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 0 8px;
}

.history-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    color: #f7eee8;
    font-size: 20px;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
    cursor: pointer;
}

.history-page-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(216,167,95,0.3);
}

.history-page-btn.is-disabled {
    opacity: 0.3;
    pointer-events: none;
}

.history-page-info {
    font-size: 13px;
    color: rgba(247,238,232,0.5);
    letter-spacing: 0.05em;
    min-width: 48px;
    text-align: center;
}

/* ─── Mobile Responsiveness ≤ 480px ───────────────────── */

@media (max-width: 480px) {
    .history-main {
        padding-left: 8px;
        padding-right: 8px;
    }

    .history-screen {
        gap: 10px;
    }

    .history-shell {
        padding: 14px 14px 18px;
        gap: 12px;
    }

    .history-compact-nav {
        gap: 10px;
        padding-bottom: 4px;
    }

    .history-compact-nav__back {
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
    }

    .history-compact-nav__title span {
        font-size: 10px;
        letter-spacing: 0.15em;
    }

    .history-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none;
        gap: 6px;
    }

    .history-filters::-webkit-scrollbar {
        display: none;
    }

    .history-pill {
        flex: 0 0 auto;
        font-size: 12px;
        padding: 7px 13px;
        min-height: 34px;
    }

    .history-card {
        margin-left: 18px !important;
        padding: 13px 12px;
        border-radius: 16px;
    }

    .history-card__node {
        left: -18px !important;
    }

    .history-card__body {
        grid-template-columns: 36px 1fr;
        gap: 8px;
    }

    .history-card__icon {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }

    .history-card__head {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .history-card__copy h3 {
        font-size: 15px;
        line-height: 1.1;
    }

    .history-card__copy p {
        font-size: 12px;
    }

    .history-card__footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .history-card__actions {
        width: 100%;
        justify-content: space-between;
    }

    .history-card__actions a {
        flex: 1;
        min-height: 42px;
        font-size: 13px;
    }

    .history-toolbar {
        gap: 8px;
    }

    .history-pagination {
        padding: 16px 0 4px;
    }

    .history-page-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}
