:root {
    --primary-color: #dc0018;
    --text-color: #15141A;
    --secondary-text: #5B5B66;
    --background-light: #F0F0F4;
    --border-color: #e0e0e0;
    --header-height: 64px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', "Helvetica Neue", sans-serif;
    background: linear-gradient(135deg, #fafafa 0%, #f0f0f4 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

header {
    background: white;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 5px solid var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-wrapper {
    max-width: none;
    width: 100%;
    height: 83px;
    margin: 0;
    padding: 10px 24px; /* symmetric horizontal padding */
}

.layout-brand {
    display: flex;
    align-items: left;
    justify-content: space-between;
    height: var(--header-height);
    width: 100%;
}

.brand-left {
    display: flex;
    align-items: center;
}

.brand-logo {
    height: auto;
    width: 125px;
    margin-right: 0;
    padding: 20px 15px;
}

.header-title {
    font-family: Roboto, sans-serif;
    font-size: 26.4px;
    color: rgb(117, 117, 117);
    margin: 0;
    padding-left: 20px;
    border-left: 1px solid lightgrey;
    font-weight: 400;
}

main {
    margin-top: var(--header-height);
    padding-top: 32px;
    min-height: calc(100vh - var(--header-height));
}

.container {
    max-width: none;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 48px 1.5rem; /* reduce bottom padding to trim gap */
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-family: Roboto, sans-serif;
    font-size: 2.5rem;
    line-height: 1.2;
    font-weight: 400;
    margin: 0 0 0.75rem 0;
    letter-spacing: -0.03em;
}

.page-lead {
    font-size: 1.25em;
    color: var(--secondary-text);
    font-weight: 400;
    line-height: 1.6;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    background: white;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid #e9e9ee;
    border-radius: 10px;
    background: linear-gradient(135deg, #ffffff 0%, #f7f7fb 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
    position: relative;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    outline: none;
    overflow: hidden;
}

.stat-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    border: 1px solid rgba(220, 0, 24, 0.08);
    pointer-events: none;
}

/* Icon container for tiles */
.stat-icon {
    height: 52px;
    width: 52px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: rgba(0,0,0,0.03);
    flex: 0 0 auto;
}

.stat-icon svg {
    width: 36px;
    height: 36px;
    display: block;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    border-color: rgba(220, 0, 24, 0.2);
}

.stat-item:focus-visible {
    box-shadow: 0 0 0 3px rgba(220, 0, 24, 0.2);
}

.stat-item.active {
    border-color: rgba(220, 0, 24, 0.4);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255,255,255,0.8);
}

.stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: #222;
    font-family: 'Roboto Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    text-shadow: 0 0 12px rgba(220, 0, 24, 0.08);
    letter-spacing: 0.03em;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--secondary-text);
    text-transform: uppercase;
    letter-spacing: 0.55px;
    font-weight: 600;
}

.main-content {
    display: flex;
    height: calc(100vh - 400px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative; /* for overlay positioning */
}

#cy {
    flex: 1;
    min-width: 0;
    background: white;
}

/* Loading overlay */
.graph-loading {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(1px);
    z-index: 10;
}

.graph-loading.visible {
    display: flex;
}

.graph-loading .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e6;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin-right: 12px;
}

.graph-loading .loading-text {
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: 0.02em;
}

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

.info-panel {
    width: 350px;
    background: #fafafa;
    padding: 1.5rem;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.info-panel.visible {
    opacity: 1;
}

.info-panel h3 {
    margin: 0 0 1rem 0;
    color: var(--text-color);
    font-size: 1.25rem;
    font-weight: 600;
}

.info-content {
    color: var(--text-color);
    line-height: 1.6;
}

.info-content p {
    margin-bottom: 0.75rem;
}

.info-content h4 {
    margin: 1rem 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.property-list {
    max-height: none;
    overflow-y: auto;
    margin-top: 0.5rem;
    flex: 1;
}

.property-item {
    position: relative;
    padding: 0.5rem 0.5rem 0.5rem 1.75rem;
    background: white;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.property-item::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.15);
}

.property-item.linked::before {
    background: #4caf50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--primary-color);
    color: white;
    border-radius: 3px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
    font-weight: 600;
}

.badge.success {
    background: #4caf50;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-text);
}

footer {
    background: #f7f7f7;
    padding: 2rem 0;
    margin-top: 1.5rem; /* reduce gap above footer */
    border-top: 1px solid var(--border-color);
    width: 100%;
}

.footer-content {
    width: 100%;
    margin: 0 auto;
    padding: 0 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-links h3 {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-links a {
    color: #333;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-info {
    margin-left: auto;
    color: #666;
    font-size: 0.875rem;
}

.footer-info p {
    margin: 0;
    align-self: flex-end;
}

/* Responsive layout: stack info below graph on narrow screens */
@media (max-width: 960px) {
    .main-content {
        flex-direction: column;
        height: calc(100vh - 320px);
        min-height: 60vh;
    }

    #cy {
        width: 100%;
        flex: 1;
        height: 100%;
        min-height: 60vh;
    }

    .info-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
}

/* Beta Badge */
.beta-badge {
    position: fixed;
    top: 50px;
    right: -5px;
    z-index: 10000;
    background-color: #dc0018;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 8px 40px;
    text-transform: uppercase;
    box-shadow: -3px 3px 8px rgba(0, 0, 0, 0.3);
    transform: translateX(20%) translateY(20%) rotate(45deg);
    transform-origin: top right;
    letter-spacing: 1px;
    pointer-events: none;
}

@media (max-width: 768px) {
    .beta-badge {
        font-size: 1rem;
        padding: 6px 30px;
    }
}