:root {
    --heritage-ink: #17202a;
    --heritage-muted: #68717d;
    --heritage-line: #dfe3e7;
    --heritage-canvas: #f3f4f2;
    --heritage-paper: #ffffff;
    --heritage-nav: #202830;
    --heritage-teal: #087f78;
    --heritage-teal-dark: #066b65;
    --heritage-teal-soft: #e7f4f2;
    --heritage-gold: #b07a24;
    --heritage-gold-soft: #f8f0df;
    --heritage-red: #b83b36;
    --heritage-red-soft: #fbecea;
    --heritage-shadow: 0 10px 26px rgba(28, 38, 45, 0.08);
}

.modal-overlay.hidden {
    display: none !important;
}

html {
    max-width: 100%;
    overflow-x: hidden;
}

body.heritage-app {
    color: var(--heritage-ink);
    background: var(--heritage-canvas);
    font-family: "DM Sans", sans-serif;
    letter-spacing: 0;
}

.heritage-app #app-container {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
}

.heritage-shell {
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
}

.heritage-content {
    min-width: 0;
    padding: 24px;
}

.heritage-secondary {
    --primary-color: var(--heritage-teal);
    --primary-dark: var(--heritage-teal-dark);
    min-height: 100vh;
    padding: 0 !important;
    display: block !important;
}

.heritage-secondary .heritage-content > main,
.heritage-secondary .heritage-content > #app-container,
.heritage-secondary .heritage-content > .review-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
}

.heritage-secondary #app-container {
    min-height: 0;
    display: block;
}

.heritage-secondary #app-container.hidden,
.heritage-secondary main.hidden {
    display: none;
}

.heritage-secondary #app-container > div,
.heritage-secondary main > div {
    border: 1px solid var(--heritage-line);
    border-radius: 0 !important;
    background: var(--heritage-paper);
    box-shadow: var(--heritage-shadow) !important;
}

.heritage-secondary .review-container {
    padding: 18px 0 0;
    background: transparent;
}

.heritage-secondary .review-page-header {
    margin-bottom: 18px;
    padding: 20px;
    border-top: 3px solid var(--heritage-teal);
    border-bottom: 1px solid var(--heritage-line);
    background: var(--heritage-paper);
}

.heritage-secondary .review-page-title {
    font-size: 30px;
    line-height: 1.05;
}

.heritage-secondary .review-card,
.heritage-secondary .stat-card {
    border-color: var(--heritage-teal);
    box-shadow: 0 4px 14px rgba(28, 38, 45, .06);
}

.heritage-secondary h1 {
    color: var(--heritage-ink) !important;
    font-family: "Newsreader", serif;
    letter-spacing: 0;
}

.heritage-secondary h2,
.heritage-secondary h3 {
    letter-spacing: 0;
}

.heritage-secondary .review-nav,
.heritage-secondary header nav[aria-label="Page navigation"],
.heritage-secondary #traffic-category,
.heritage-secondary #sales-category,
.heritage-secondary #account-category {
    display: none !important;
}

.heritage-secondary .heritage-content > .flex:has(> #traffic-category) {
    display: none !important;
}

.heritage-subnav {
    width: 100%;
    max-width: 1440px;
    min-height: 48px;
    margin: 0 auto 12px;
    border-bottom: 1px solid var(--heritage-line);
    background: var(--heritage-paper);
    display: flex;
    align-items: stretch;
    overflow-x: auto;
}

.heritage-subnav a {
    min-height: 48px;
    padding: 0 16px;
    color: var(--heritage-muted);
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.heritage-subnav a:hover,
.heritage-subnav a[aria-current="page"] {
    color: var(--heritage-teal-dark);
    background: var(--heritage-teal-soft);
}

.heritage-subnav a[aria-current="page"] {
    box-shadow: inset 0 -3px var(--heritage-teal);
}

.heritage-secondary .bg-blue-600,
.heritage-secondary .bg-green-600,
.heritage-secondary .btn-primary,
.heritage-secondary .btn-success {
    background-color: var(--heritage-teal) !important;
}

.heritage-secondary .text-blue-600,
.heritage-secondary .text-blue-700 {
    color: var(--heritage-teal-dark) !important;
}

.heritage-secondary .border-blue-500,
.heritage-secondary .border-blue-600 {
    border-color: var(--heritage-teal) !important;
}

.heritage-secondary .bg-blue-50 {
    background-color: var(--heritage-teal-soft) !important;
}

.heritage-secondary .rounded,
.heritage-secondary .rounded-md,
.heritage-secondary .rounded-lg,
.heritage-secondary .rounded-xl,
.heritage-secondary .review-card,
.heritage-secondary .stat-card {
    border-radius: 0 !important;
}

.heritage-secondary button,
.heritage-secondary input,
.heritage-secondary select,
.heritage-secondary textarea {
    min-height: 44px;
}

@media (max-width: 959px) {
    .heritage-shell,
    .heritage-app #app-container {
        grid-template-columns: 78px minmax(0, 1fr);
    }

    .heritage-shell .heritage-sidebar,
    .heritage-app #app-container > .heritage-sidebar {
        padding-inline: 10px;
    }

    .heritage-shell .heritage-brand-name,
    .heritage-shell .heritage-nav-label,
    .heritage-shell .heritage-nav-link span,
    .heritage-app #app-container > .heritage-sidebar .heritage-brand-name,
    .heritage-app #app-container > .heritage-sidebar .heritage-nav-label,
    .heritage-app #app-container > .heritage-sidebar .heritage-nav-link span {
        display: none;
    }

    .heritage-shell .heritage-brand,
    .heritage-shell .heritage-nav-link,
    .heritage-app #app-container > .heritage-sidebar .heritage-brand,
    .heritage-app #app-container > .heritage-sidebar .heritage-nav-link {
        padding-inline: 0;
        justify-content: center;
    }

    .heritage-content {
        padding: 16px;
    }
}

@media (max-width: 540px) {
    .heritage-shell {
        display: block;
        padding-bottom: 66px;
    }

    .heritage-shell .heritage-sidebar {
        position: fixed;
        inset: auto 0 0;
        z-index: 900;
        width: 100%;
        height: 66px;
        padding: 6px 8px;
        border-top: 1px solid rgba(255, 255, 255, .16);
        flex-direction: row;
        align-items: center;
    }

    .heritage-shell .heritage-brand,
    .heritage-shell .heritage-nav-label,
    .heritage-shell .heritage-nav-spacer,
    .heritage-shell .heritage-logout {
        display: none;
    }

    .heritage-shell .heritage-nav-link {
        min-width: 0;
        height: 54px;
        flex: 1;
    }

    .heritage-shell .heritage-nav-link.active {
        box-shadow: inset 0 3px #e3b65d;
    }

    .heritage-content {
        padding: 10px;
    }

    .heritage-subnav {
        max-width: 100%;
    }

    .heritage-secondary .heritage-content > .min-h-screen,
    .heritage-secondary .heritage-content > .print-container {
        min-height: 0;
        padding: 0 !important;
    }

    .heritage-secondary .mb-6.flex.gap-4.items-center,
    .heritage-secondary .flex.gap-6,
    .heritage-secondary #pagination {
        min-width: 0;
        flex-wrap: wrap;
    }

    .heritage-secondary .mb-6.flex.gap-4.items-center > input,
    .heritage-secondary .mb-6.flex.gap-4.items-center > select {
        min-width: 0;
        flex: 1 1 150px;
    }

    .heritage-secondary .review-container {
        padding-top: 10px;
    }

    .heritage-secondary .review-page-header {
        margin-bottom: 10px;
        padding: 16px 14px;
    }

    .heritage-secondary .review-page-title {
        font-size: 26px;
    }

    .heritage-secondary .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 10px;
    }

    .heritage-secondary .stat-card {
        min-height: 110px;
        padding: 14px;
    }

    .heritage-secondary .stat-value {
        font-size: 26px;
    }
}

.heritage-app #app-container.hidden {
    display: none;
}

.heritage-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 16px;
    color: #f8fafb;
    background: var(--heritage-nav);
    display: flex;
    flex-direction: column;
}

.heritage-brand {
    padding: 0 8px 26px;
    color: white;
    display: flex;
    align-items: center;
    gap: 11px;
    font-weight: 700;
    text-decoration: none;
}

.heritage-brand-mark {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, .24);
    color: #f1c878;
    background: rgba(255, 255, 255, .06);
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.heritage-brand-mark svg,
.heritage-nav-link svg {
    width: 18px;
    height: 18px;
}

.heritage-brand-mark img,
.paper-brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.print-brand-masthead {
    display: none;
    margin: 0 auto 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--heritage-teal);
    color: var(--heritage-nav);
    align-items: center;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    text-align: center;
}
.print-brand-masthead .paper-brand-mark {
    width: 58px;
    height: 58px;
    border: 0;
}
.print-brand-masthead strong {
    font-family: "Newsreader", serif;
    font-size: 22px;
    letter-spacing: 0;
}
.print-brand-contact { color: var(--heritage-muted); font: 10px "DM Sans", sans-serif; }
.print-brand-contact > span:not([hidden]) + span:not([hidden])::before { content: " · "; }

.heritage-nav-label {
    padding: 0 10px 8px;
    color: #91a0ad;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.heritage-nav-link {
    width: 100%;
    min-height: 44px;
    border: 0;
    padding: 0 11px;
    color: #cbd3da;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 11px;
    text-align: left;
    text-decoration: none;
}

.heritage-nav-link.hidden {
    display: none !important;
}

.heritage-nav-link:hover,
.heritage-nav-link.active {
    color: white;
    background: rgba(255, 255, 255, .1);
}

.heritage-nav-link.active {
    box-shadow: inset 3px 0 #e3b65d;
}

.heritage-nav-link.disabled {
    cursor: not-allowed;
    opacity: .62;
}

.heritage-nav-link.disabled small {
    margin-left: auto;
    color: #f1c878;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.heritage-nav-spacer {
    flex: 1;
}

.heritage-logout {
    border-top: 1px solid rgba(255, 255, 255, .12);
    color: #f0c6c2;
}

.heritage-main {
    align-self: start;
    margin: 24px;
    width: calc(100% - 48px);
}

.heritage-app .legacy-toolbar {
    display: none;
}

.heritage-app #app-container > .heritage-main {
    border: 1px solid var(--heritage-line);
    border-radius: 0;
    box-shadow: var(--heritage-shadow);
}

.heritage-app .page-kicker {
    margin-bottom: 4px;
    color: var(--heritage-teal);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.heritage-app .page-title {
    color: var(--heritage-ink);
    font-family: "Newsreader", serif;
    font-size: 36px;
    line-height: 1;
}

.store-pulse {
    margin-bottom: 24px;
    border-top: 3px solid var(--heritage-teal);
    border-bottom: 1px solid var(--heritage-line);
    background: var(--heritage-paper);
}

.store-pulse-heading {
    min-height: 62px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.store-pulse-kicker,
.store-pulse-heading h2 {
    margin: 0;
}

.store-pulse-kicker {
    color: var(--heritage-muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.store-pulse-heading h2 {
    font-family: "Newsreader", serif;
    font-size: 24px;
    line-height: 1.1;
}

#store-pulse-period {
    color: var(--heritage-muted);
    font-size: 12px;
    font-weight: 600;
}

.store-pulse-controls {
    min-height: 60px;
    padding: 8px 14px;
    border-top: 1px solid var(--heritage-line);
    display: flex;
    align-items: end;
    gap: 10px;
}

.pulse-period-selector {
    min-height: 44px;
    display: inline-flex;
    border: 1px solid var(--heritage-line);
}

.heritage-app .pulse-period-selector button {
    min-height: 42px;
    padding: 0 12px;
    border: 0;
    border-right: 1px solid var(--heritage-line);
    color: var(--heritage-muted);
    background: white;
    font-size: 12px;
    font-weight: 700;
}

.heritage-app .pulse-period-selector button:last-child {
    border-right: 0;
}

.heritage-app .pulse-period-selector button[aria-pressed="true"] {
    color: white;
    background: var(--heritage-teal);
}

.pulse-date-control {
    color: var(--heritage-muted);
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.heritage-app .pulse-date-control input {
    width: 146px;
    min-height: 42px;
    padding: 0 9px;
    border: 1px solid var(--heritage-line);
    color: var(--heritage-ink);
    background: white;
    font-size: 12px;
}

.pulse-custom-controls {
    display: flex;
    align-items: end;
    gap: 8px;
}

.pulse-custom-controls.hidden,
.pulse-date-control.hidden {
    display: none;
}

.heritage-app .pulse-refresh {
    width: 42px;
    min-height: 42px;
    margin-left: auto;
    border: 1px solid var(--heritage-line);
    color: var(--heritage-teal);
    background: white;
    display: grid;
    place-items: center;
}

.pulse-refresh svg {
    width: 17px;
    height: 17px;
}

.pulse-refresh.is-loading svg {
    animation: pulse-spin .8s linear infinite;
}

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

.store-pulse-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--heritage-line);
}

.store-pulse-metric {
    min-width: 0;
    min-height: 116px;
    padding: 16px 14px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 24px;
    align-items: start;
    gap: 10px;
    border-right: 1px solid var(--heritage-line);
}

.store-pulse-metric:last-child {
    border-right: 0;
}

.store-pulse-icon {
    width: 34px;
    height: 34px;
    color: var(--heritage-teal);
    background: var(--heritage-teal-soft);
    display: grid;
    place-items: center;
}

.store-pulse-icon svg,
.store-pulse-metric > a svg {
    width: 17px;
    height: 17px;
}

.store-pulse-metric > div:nth-child(2) {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.store-pulse-metric span {
    color: var(--heritage-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.store-pulse-metric strong {
    margin: 3px 0;
    font-family: "Newsreader", serif;
    font-size: 26px;
    line-height: 1;
}

.store-pulse-metric small {
    min-height: 30px;
    color: var(--heritage-muted);
    font-size: 11px;
    line-height: 1.35;
}

.store-pulse-metric .pulse-freshness {
    min-height: 16px;
    margin-top: 5px;
    color: var(--heritage-teal-dark);
    font-size: 10px;
    font-weight: 700;
}

.store-pulse-metric .pulse-freshness.is-stale {
    color: var(--heritage-gold);
}

.store-pulse-metric[data-state="unavailable"],
.store-pulse-metric[data-state="restricted"] {
    background: #f8f9f9;
}

.store-pulse-metric > a {
    width: 24px;
    height: 24px;
    color: var(--heritage-muted);
    display: grid;
    place-items: center;
}

.store-pulse-metric > a:hover {
    color: var(--heritage-teal);
}

.store-pulse-status {
    min-height: 36px;
    margin: 0;
    padding: 9px 14px;
    border-top: 1px solid var(--heritage-line);
    color: var(--heritage-teal-dark);
    background: var(--heritage-teal-soft);
    font-size: 12px;
    font-weight: 600;
}

.store-pulse-status.has-attention {
    color: #785416;
    background: var(--heritage-gold-soft);
}

.heritage-app #gold-price-widget {
    border: 1px solid #e3cc98;
    border-radius: 0;
    background: linear-gradient(110deg, #fffaf0, var(--heritage-gold-soft));
    box-shadow: none;
}

.heritage-app #gold-price-widget h3 {
    color: var(--heritage-gold);
}

.heritage-app #gold-price-widget .bg-white {
    border-color: #eadbb8;
    border-radius: 0;
    box-shadow: none;
}

.heritage-app button,
.heritage-app input,
.heritage-app select {
    min-height: 44px;
}

.heritage-app .bg-blue-600,
.heritage-app .bg-green-500 {
    background-color: var(--heritage-teal) !important;
}

.heritage-app .hover\:bg-blue-700:hover,
.heritage-app .hover\:bg-green-600:hover {
    background-color: var(--heritage-teal-dark) !important;
}

.heritage-app .bg-gray-800 {
    background-color: var(--heritage-nav) !important;
}

.heritage-app .modal-content {
    border: 1px solid var(--heritage-line);
    border-top: 4px solid var(--heritage-teal);
    border-radius: 0;
    box-shadow: var(--heritage-shadow);
}

.heritage-app input:focus,
.heritage-app select:focus {
    border-color: var(--heritage-teal) !important;
    outline: 2px solid var(--heritage-teal-soft);
    box-shadow: none !important;
}

@media (min-width: 960px) and (max-width: 1100px) and (orientation: landscape) {
    body.heritage-app {
        padding: 0;
    }

    .heritage-app #app-container {
        grid-template-columns: 78px minmax(0, 1fr);
    }

    .heritage-sidebar {
        padding-inline: 10px;
    }

    .heritage-brand-name,
    .heritage-nav-label,
    .heritage-nav-link span,
    .heritage-nav-link small {
        display: none;
    }

    .heritage-brand,
    .heritage-nav-link {
        padding-inline: 0;
        justify-content: center;
    }

    .heritage-main {
        margin: 16px;
        width: calc(100% - 32px);
        max-width: none;
        padding: 20px;
    }

    .heritage-app .page-title {
        font-size: 32px;
    }

    .heritage-app #gold-price-widget {
        padding: 12px;
    }

    .heritage-app #gold-price-widget .grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 8px;
    }

    .heritage-app #gold-price-widget .min-h-24 {
        min-height: 76px;
        padding: 10px;
    }

    .store-pulse-metric {
        grid-template-columns: 30px minmax(0, 1fr) 20px;
        padding: 14px 10px;
        gap: 8px;
    }

    .store-pulse-icon {
        width: 30px;
        height: 30px;
    }

    .store-pulse-controls {
        flex-wrap: wrap;
    }
}

@media (max-width: 959px) {
    .store-pulse-controls {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .pulse-period-selector {
        width: 100%;
    }

    .heritage-app .pulse-period-selector button {
        min-width: 0;
        padding-inline: 6px;
        flex: 1;
    }

    .pulse-custom-controls {
        width: calc(100% - 52px);
    }

    .pulse-custom-controls .pulse-date-control {
        min-width: 0;
        flex: 1;
    }

    .heritage-app .pulse-date-control input {
        width: 100%;
    }

    .heritage-app .pulse-refresh {
        margin-left: auto;
        align-self: end;
    }

    .store-pulse-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .store-pulse-metric:nth-child(2) {
        border-right: 0;
    }

    .store-pulse-metric:nth-child(-n + 2) {
        border-bottom: 1px solid var(--heritage-line);
    }
}

@media (max-width: 720px) {
    body.heritage-app {
        padding: 0;
    }

    .heritage-app #app-container {
        display: block;
    }

    .heritage-app #app-container.hidden {
        display: none;
    }

    .heritage-sidebar {
        position: sticky;
        z-index: 40;
        width: 100%;
        height: auto;
        padding: 8px 10px;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }

    .heritage-brand {
        padding: 0 8px 0 0;
    }

    .heritage-brand-name,
    .heritage-nav-label,
    .heritage-nav-link span,
    .heritage-nav-link small,
    .heritage-nav-spacer {
        display: none;
    }

    .heritage-nav-link {
        width: 44px;
        padding: 0;
        justify-content: center;
        flex: 0 0 44px;
    }

    .heritage-logout {
        border-top: 0;
    }

    .heritage-main {
        margin: 10px;
        width: calc(100% - 20px);
        padding: 14px;
    }
}