/* OFFHUB Theme — Controlled Execution Layer · stealth palette */
@font-face { font-family:'Inter'; src:url('../fonts/inter-300.ttf') format('truetype'); font-weight:300; font-display:swap; }
@font-face { font-family:'Inter'; src:url('../fonts/inter-400.ttf') format('truetype'); font-weight:400; font-display:swap; }
@font-face { font-family:'Inter'; src:url('../fonts/inter-500.ttf') format('truetype'); font-weight:500; font-display:swap; }
@font-face { font-family:'Inter'; src:url('../fonts/inter-600.ttf') format('truetype'); font-weight:600; font-display:swap; }
@font-face { font-family:'JetBrains Mono'; src:url('../fonts/jetbrains-mono-300.ttf') format('truetype'); font-weight:300; font-display:swap; }
@font-face { font-family:'JetBrains Mono'; src:url('../fonts/jetbrains-mono-400.ttf') format('truetype'); font-weight:400; font-display:swap; }
@font-face { font-family:'JetBrains Mono'; src:url('../fonts/jetbrains-mono-500.ttf') format('truetype'); font-weight:500; font-display:swap; }
@font-face { font-family:'Playfair Display'; src:url('../fonts/playfair-display-400.ttf') format('truetype'); font-weight:400; font-display:swap; }
@font-face { font-family:'Playfair Display'; src:url('../fonts/playfair-display-500.ttf') format('truetype'); font-weight:500; font-display:swap; }
@font-face { font-family:'Playfair Display'; src:url('../fonts/playfair-display-600.ttf') format('truetype'); font-weight:600; font-display:swap; }

:root {
    /* Brand Colors — muted gold accent only */
    --gold-primary: #C9A861;
    --gold-accent: #E8C97A;
    --gold-dark: #8B7340;
    --gold-dim: rgba(201, 168, 97, 0.10);
    --gold-glow: rgba(201, 168, 97, 0.06);

    /* Background Colors — near-black stealth stack */
    --black-primary: #000000;
    --dark-background: #09090B;
    --darker-background: #000000;
    --card-background: #18181B;
    --card-background-dark: #111113;
    --card-background-elevated: #1F1F23;
    --surface: #111113;
    --surface-2: #18181B;
    --surface-3: #1F1F23;

    /* Text Colors */
    --white-text: #F4F0E8;
    --gray-text: #9B9790;
    --subtitle-gray: #5A5752;
    --placeholder-gray: #3F3D38;
    --icon-gray: #5A5752;
    --text-1: #F4F0E8;
    --text-2: #9B9790;
    --text-3: #5A5752;

    /* Borders — translucent whites */
    --border-soft: rgba(255, 255, 255, 0.07);
    --border-mid: rgba(255, 255, 255, 0.12);
    --border-strong: rgba(255, 255, 255, 0.18);

    /* Archive Blue */
    --archive-blue: #2563EB;
    --archive-blue-subtle: rgba(37, 99, 235, 0.30);

    /* Status Colors — restrained */
    --error-red: #C0392B;
    --error-red-dark: #A02E22;
    --error-red-darker: #7D241B;
    --error-background: rgba(192, 57, 43, 0.15);
    --success-green: #3DB870;
    --success-green-dark: #2D7A56;
    --warning-orange: #C17D2A;
    --info-blue: #2563EB;
    --red: #C0392B;
    --red-dim: rgba(192, 57, 43, 0.15);
    --amber: #C17D2A;
    --amber-dim: rgba(193, 125, 42, 0.12);
    --green: #2D7A56;
    --green-2: #3DB870;
    --green-dim: rgba(45, 122, 86, 0.12);
    --blue: #2563EB;
    --blue-dim: rgba(37, 99, 235, 0.12);

    /* Overlays */
    --overlay-black-80: rgba(9, 9, 11, 0.85);
    --overlay-black-70: rgba(9, 9, 11, 0.75);
    --transparent-black-50: rgba(9, 9, 11, 0.55);
    --transparent-black-20: rgba(9, 9, 11, 0.25);

    /* Typography */
    --f-display: 'Playfair Display', Georgia, serif;
    --f-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --f-mono: 'JetBrains Mono', 'Courier New', monospace;

    /* Layout */
    --nav-width: 240px;
    --border-radius: 6px;
    --border-radius-lg: 10px;
}

/* Global Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--f-ui);
    background-color: var(--dark-background);
    color: var(--white-text);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    line-height: 1.6;
}

/* Focus ring */
:focus-visible {
    outline: 1px solid var(--gold-primary);
    outline-offset: 2px;
}

/* Doctrine helpers */
.mono { font-family: var(--f-mono); }
.display { font-family: var(--f-display); }

.doctrine-box {
    border: 1px solid var(--border-mid);
    background: var(--surface);
    padding: 12px 14px;
    border-radius: var(--border-radius);
    color: var(--text-2);
    font-size: 12px;
    line-height: 1.6;
}
.doctrine-box .doctrine-label {
    font-family: var(--f-mono);
    font-size: 10px;
    color: var(--gold-primary);
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.gated-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: .06em;
    color: var(--gold-primary);
    background: var(--gold-dim);
    border: 1px solid var(--gold-dim);
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.gated-overlay {
    position: relative;
    overflow: hidden;
    background:
        repeating-linear-gradient(
            45deg,
            rgba(255,255,255,0.012) 0,
            rgba(255,255,255,0.012) 10px,
            transparent 10px,
            transparent 20px
        ),
        var(--surface);
    border: 1px dashed var(--border-mid);
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* Layout */
.offhub-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background-color: var(--dark-background);
}

.main-content.with-nav {
    margin-left: var(--nav-width);
}

/* Side Navigation */
.side-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--nav-width);
    height: 100vh;
    background-color: var(--black-primary);
    border-right: 1px solid var(--card-background);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.nav-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--card-background);
}

.mobile-nav-bar,
.mobile-nav-close,
.mobile-nav-backdrop {
    display: none;
}

.brand-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--gold-primary);
    letter-spacing: 2px;
}

.nav-links {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--gray-text);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item:hover {
    background-color: var(--card-background-dark);
    color: var(--white-text);
}

.nav-item.active {
    color: var(--gold-primary);
    background-color: var(--card-background-dark);
    border-left: 3px solid var(--gold-primary);
}

/* Doctrine deal timeline (used in dashboard cards + detail page) */
.deal-timeline {
    display: flex;
    align-items: flex-start;
    gap: 0;
    width: 100%;
    margin: 8px 0;
    font-family: var(--f-mono);
    font-size: 9px;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.deal-timeline-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    color: var(--text-3);
}
.deal-timeline-step::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 50%;
    right: -50%;
    height: 1px;
    background: var(--border-soft);
}
.deal-timeline-step:last-child::before { display: none; }
.deal-timeline-step .dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1px solid var(--border-mid);
    background: var(--surface);
    position: relative;
    z-index: 1;
}
.deal-timeline-step.is-passed .dot {
    background: var(--gold-primary);
    border-color: var(--gold-primary);
}
.deal-timeline-step.is-passed::before { background: var(--gold-primary); }
.deal-timeline-step.is-passed { color: var(--text-2); }
.deal-timeline-step.is-current .dot {
    background: var(--gold-accent);
    border-color: var(--gold-accent);
    box-shadow: 0 0 0 3px var(--gold-dim);
}
.deal-timeline-step.is-current { color: var(--gold-primary); }

.deal-timeline.is-declined .deal-timeline-step.is-current .dot {
    background: var(--red);
    border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-dim);
}
.deal-timeline.is-declined .deal-timeline-step.is-current { color: var(--red); }

.nav-section-header {
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 18px 20px 6px;
    border-top: 1px solid var(--border-soft);
    margin-top: 8px;
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon svg {
    display: block;
}

.nav-label {
    font-size: 14px;
    font-weight: 500;
}

/* Badge */
.badge {
    background-color: var(--error-red);
    color: var(--white-text);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    margin-left: auto;
}

.badge.warning {
    background-color: var(--warning-orange);
}

/* Cards */
.card {
    background-color: var(--card-background);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--gold-primary);
    color: var(--black-primary);
}

.btn-primary:hover {
    background-color: var(--gold-accent);
}

.btn-secondary {
    background-color: var(--card-background);
    color: var(--white-text);
    border: 1px solid var(--placeholder-gray);
}

.btn-secondary:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
}

.btn-danger {
    background-color: var(--error-red-darker);
    color: var(--white-text);
}

.btn-danger:hover {
    background-color: var(--error-red);
}

/* Input Fields */
.input-field {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--card-background);
    border: 1px solid var(--placeholder-gray);
    border-radius: var(--border-radius);
    color: var(--white-text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-field:focus {
    border-color: var(--gold-primary);
}

.input-field::placeholder {
    color: var(--placeholder-gray);
}

/* Toast container */
#toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
    pointer-events: none;
}

/* Toast */
.toast-banner {
    max-width: 400px;
    padding: 16px 20px;
    border-radius: var(--border-radius-lg);
    background-color: var(--card-background);
    color: var(--white-text);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease-out;
    cursor: pointer;
    border-left: 4px solid var(--gold-primary);
    pointer-events: auto;
}

.toast-banner.success { border-left-color: var(--success-green); }
.toast-banner.error { border-left-color: var(--error-red); }
.toast-banner.info { border-left-color: var(--info-blue); }
.toast-banner.warning { border-left-color: var(--warning-orange); }

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.toast-body {
    font-size: 13px;
    color: var(--gray-text);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--card-background) 25%, var(--card-background-dark) 50%, var(--card-background) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Grid layouts */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.artifact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    align-items: stretch;
    padding: 8px 0;
}

/* Chat layout */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 48px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
    padding: 16px;
    gap: 8px;
}

.chat-input-area {
    padding: 12px 16px;
    background-color: var(--card-background-dark);
    border-top: 1px solid var(--card-background);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

/* Message bubbles */
.message-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.message-bubble.mine {
    align-self: flex-end;
    background-color: var(--gold-dark);
    color: var(--white-text);
    border-bottom-right-radius: 4px;
}

.message-bubble.theirs {
    align-self: flex-start;
    background-color: var(--card-background);
    color: var(--white-text);
    border-bottom-left-radius: 4px;
}

/* Chat image thumbnails */
.chat-image-thumb img {
    max-width: 240px;
    max-height: 240px;
    border-radius: 8px;
    object-fit: cover;
}

/* Offer cards */
.offer-card {
    background-color: var(--card-background-dark);
    border: 1px solid var(--gold-dark);
    border-radius: var(--border-radius-lg);
    padding: 16px;
    max-width: 320px;
}

.offer-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--gold-primary);
}

/* Status badges — execution-layer doctrine style.
   Call sites set `style="--status-color: #..."` and the badge picks up
   a thin border + subtle tinted background + matching text color. */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border: 1px solid color-mix(in srgb, var(--status-color, var(--gold-primary)) 40%, transparent);
    background: color-mix(in srgb, var(--status-color, var(--gold-primary)) 14%, transparent);
    color: var(--status-color, var(--gold-primary));
    border-radius: 4px;
    font-family: var(--f-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    line-height: 1.4;
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: var(--overlay-black-80);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background-color: var(--card-background);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-nav-bar {
        position: fixed;
        z-index: 90;
        inset: 0 0 auto;
        height: 64px;
        padding: 0 18px;
        background-color: var(--black-primary);
        border-bottom: 1px solid var(--card-background);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .mobile-nav-bar .brand-text {
        font-size: 20px;
    }

    .mobile-nav-toggle,
    .mobile-nav-close {
        width: 44px;
        height: 44px;
        border: 0;
        background: transparent;
        color: var(--white-text);
        display: grid;
        place-items: center;
        cursor: pointer;
    }

    .mobile-nav-close {
        font-size: 30px;
        line-height: 1;
    }

    .mobile-nav-backdrop {
        position: fixed;
        z-index: 95;
        inset: 0;
        width: 100%;
        height: 100%;
        border: 0;
        background: rgba(0, 0, 0, 0.7);
        display: block;
    }

    .side-nav {
        z-index: 100;
        width: min(84vw, 320px);
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.2s ease, visibility 0.2s;
        box-shadow: 18px 0 48px rgba(0, 0, 0, 0.45);
    }

    .side-nav.mobile-open {
        transform: translateX(0);
        visibility: visible;
    }

    .side-nav .nav-brand {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 12px 10px 20px;
        min-height: 64px;
    }

    .side-nav .nav-links {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }

    .main-content.with-nav {
        margin-left: 0;
        padding-top: 64px;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--placeholder-gray);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--icon-gray);
}
