/* =============================================================
   TV FRAMEWORK V6.0 - Industrial Pop Design
   "Blueprint & Safety" Color Palette
   ============================================================= */

:root {
    /* --- INDUSTRIAL POP PALETTE --- */
    --tv-deep-slate: #2C3E50;
    --tv-industrial-amber: #F39C12;
    --tv-technical-mint: #1ABC9C;
    --tv-paper-white: #ECF0F1;

    /* --- MAPPED COLORS --- */
    --tv-primary: var(--tv-deep-slate);
    --tv-accent: var(--tv-industrial-amber);
    --tv-accent-secondary: var(--tv-technical-mint);

    /* Kategorifarger */
    --tv-offer-blue: #3498db;

    /* Statusfarger */
    --tv-success: var(--tv-technical-mint);
    --tv-warning: var(--tv-industrial-amber);
    --tv-error: #e74c3c;

    /* --- NØYTRALE FARGER --- */
    --tv-bg: var(--tv-paper-white);
    --tv-card-bg: #ffffff;
    --tv-border: rgba(44, 62, 80, 0.12);
    --tv-text: var(--tv-deep-slate);
    --tv-text-light: #64748b;

    /* --- FORM OG FORMAT --- */
    --tv-radius-pill: 50px;
    --tv-radius-card: 16px;
    --tv-radius-sm: 12px;

    /* --- HARD SHADOWS --- */
    --tv-shadow-hard: 0 4px 0 rgba(0, 0, 0, 0.15);
    --tv-shadow-hard-sm: 0 3px 0 rgba(0, 0, 0, 0.1);
    --tv-shadow-pressed: 0 2px 0 rgba(0, 0, 0, 0.1);
}

/* --- BASIS OPPSETT --- */
body {
    font-family: 'Barlow', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--tv-bg);
    color: var(--tv-text);
    margin: 0;
    line-height: 1.6;
}

/* --- 1. HEADER OG STATUS --- */

.tv-header-back-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: var(--tv-paper-white);
    width: 36px;
    height: 36px;
    border-radius: var(--tv-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: var(--tv-shadow-hard-sm);
}

.tv-header-back-btn:hover {
    background: var(--tv-industrial-amber);
    color: var(--tv-deep-slate);
}

.tv-header-back-btn:active {
    transform: translateY(2px);
    box-shadow: var(--tv-shadow-pressed);
}

.tv-header {
    background: var(--tv-deep-slate);
    color: var(--tv-paper-white);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--tv-shadow-hard);
}

.tv-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- HEADER STATUS (PILL SYSTEM) --- */

.tv-status-pill {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;

    padding: 0 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--tv-radius-sm);

    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);

    height: 36px;
    box-sizing: border-box;
    min-width: 140px;
    z-index: 10;
}

#tv-pill-text {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    font-size: 10px;
    line-height: 36px;

    flex-grow: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-pill-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;

    display: block;
    position: static;
    flex-shrink: 0;

    background-color: #94a3b8;

    box-shadow: none !important;
    border: none !important;
    outline: none !important;
    margin: 0 !important;
}

/* --- FARGER --- */

/* 1. ORANSJE (Venter/Lagrer) */
.tv-status-pill.pending .tv-pill-dot {
    background-color: var(--tv-industrial-amber) !important;
    animation: tv-pulse-flat 1s infinite alternate;
}

/* 2. GRØNN (Ferdig) */
.tv-status-pill.success .tv-pill-dot {
    background-color: var(--tv-technical-mint) !important;
    animation: tv-pulse-flat 2s infinite alternate;
}

/* 3. RØD (Feil) */
.tv-status-pill.error .tv-pill-dot {
    background-color: var(--tv-error) !important;
    animation: tv-blink-flat 0.5s infinite alternate;
}
.tv-status-pill.error {
    border-color: rgba(231, 76, 60, 0.5);
    color: #fca5a5;
}

/* --- ANIMASJONER --- */
@keyframes tv-pulse-flat {
    0% { opacity: 1; }
    100% { opacity: 0.6; }
}
@keyframes tv-blink-flat {
    0% { opacity: 1; }
    100% { opacity: 0.2; }
}

/* --- 2. KNAPPER --- */
.tv-btn-pill {
    background: var(--tv-industrial-amber);
    color: var(--tv-deep-slate);
    border: none;
    padding: 10px 24px;
    border-radius: var(--tv-radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-family: 'Barlow', system-ui, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: var(--tv-shadow-hard-sm);
}

.tv-btn-pill:hover {
    background: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.15);
}

.tv-btn-pill:active {
    transform: translateY(2px);
    box-shadow: var(--tv-shadow-pressed);
}

.tv-btn-pill.small-header-btn {
    padding: 8px 18px;
    font-size: 0.85rem;
}

.tv-btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: var(--tv-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--tv-paper-white);
    font-size: 1rem;
    box-shadow: var(--tv-shadow-hard-sm);
}

.tv-btn-icon:hover {
    background: var(--tv-industrial-amber);
    color: var(--tv-deep-slate);
}

.tv-btn-icon:active {
    transform: translateY(2px);
    box-shadow: var(--tv-shadow-pressed);
}

.tv-btn-icon.share {
    color: var(--tv-technical-mint);
}
.tv-btn-icon.share:hover {
    background: var(--tv-technical-mint);
    color: white;
}

/* --- 3. LAYOUT --- */
.tv-card {
    background: var(--tv-card-bg);
    padding: 25px;
    border-radius: var(--tv-radius-card);
    box-shadow: var(--tv-shadow-hard-sm);
    margin: 20px auto;
    max-width: 1000px;
    border: 2px solid var(--tv-border);
}

/* --- 4. SØKEMOTOR OG INPUTS --- */
.tv-search-wrapper {
    padding: 15px 20px;
    background: #fff;
    border-bottom: 2px solid var(--tv-border);
    display: flex;
    align-items: center;
    position: relative;
}

.tv-search-wrapper i {
    position: absolute;
    left: 35px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tv-text-light);
    pointer-events: none;
    z-index: 10;
}

.tv-search-input {
    width: 100% !important;
    padding: 12px 20px 12px 50px !important;
    border-radius: var(--tv-radius-sm);
    border: 2px solid var(--tv-border);
    background: var(--tv-paper-white);
    font-size: 0.95rem;
    display: block;
    transition: border-color 0.2s;
}

.tv-search-input:focus {
    outline: none;
    border-color: var(--tv-industrial-amber);
}

.tv-input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--tv-border);
    border-radius: var(--tv-radius-sm);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.tv-input:focus {
    outline: none;
    border-color: var(--tv-industrial-amber);
}

/* --- 5. MODAL / UTFORSKER --- */
.tv-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 62, 80, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.tv-modal-overlay.active {
    display: flex !important;
}

.tv-modal {
    background: white;
    width: 90%;
    max-width: 550px;
    border-radius: var(--tv-radius-card);
    overflow: hidden;
    box-shadow: var(--tv-shadow-hard);
    border: 2px solid var(--tv-deep-slate);
}

.tv-modal-header {
    padding: 18px 25px;
    background: var(--tv-deep-slate);
    color: var(--tv-paper-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tv-modal-header h3 {
    margin: 0;
    font-family: 'Barlow', system-ui, sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tv-modal-header button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: var(--tv-paper-white);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tv-modal-header button:hover {
    background: var(--tv-industrial-amber);
    color: var(--tv-deep-slate);
}

.tv-modal-body {
    max-height: 400px;
    overflow-y: auto;
}

/* --- 6. PROSJEKTLISTE --- */
.project-item {
    padding: 12px 14px;
    border-bottom: 1px solid var(--tv-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    background: transparent;
}

.project-item:hover {
    background: rgba(44, 62, 80, 0.03);
}

.project-item.active {
    background: rgba(243, 156, 18, 0.06);
    border-left: 3px solid var(--tv-industrial-amber);
    padding-left: 11px;
}

.project-item-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.project-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.project-item-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--tv-deep-slate);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.project-item-kunde {
    font-size: 0.7rem;
    color: var(--tv-text-light);
    background: var(--tv-surface);
    border: 1px solid var(--tv-border);
    border-radius: 4px;
    padding: 1px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
    flex-shrink: 0;
}

.project-meta {
    font-size: 0.7rem;
    color: var(--tv-text-light);
    margin-top: 3px;
    letter-spacing: 0.01em;
}

.project-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.project-item .tv-btn-icon {
    width: 30px;
    height: 30px;
    padding: 0;
    font-size: 0.8rem;
    color: var(--tv-text-light);
    background: transparent;
    border: 1px solid var(--tv-border);
    box-shadow: none;
    opacity: 0.7;
    transition: all 0.15s ease;
}

.project-item .tv-btn-icon:hover {
    opacity: 1;
    color: var(--tv-deep-slate);
    background: var(--tv-paper-white);
    border-color: rgba(44, 62, 80, 0.2);
    transform: translateY(-1px);
}

.project-item .tv-btn-icon.open-btn:hover {
    color: var(--tv-technical-mint);
    border-color: var(--tv-technical-mint);
    background: rgba(26, 188, 156, 0.08);
}

.project-item .tv-btn-icon.share:hover {
    color: var(--tv-industrial-amber);
    border-color: var(--tv-industrial-amber);
    background: rgba(243, 156, 18, 0.08);
}

.project-item .tv-btn-icon.delete-btn:hover {
    color: var(--tv-error);
    border-color: var(--tv-error);
    background: rgba(231, 76, 60, 0.08);
}

.tv-badge-tool {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tv-deep-slate);
    color: var(--tv-paper-white);
    border-radius: 5px;
    font-size: 9px;
    flex-shrink: 0;
}

/* --- 7. BADGES & DETALJER --- */
.owner-badge {
    font-size: 10px;
    padding: 3px 10px;
    border-radius: 6px;
    background: var(--tv-deep-slate);
    color: var(--tv-industrial-amber);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shared-badge {
    font-size: 10px;
    padding: 3px 10px;
    border-radius: 6px;
    background: rgba(26, 188, 156, 0.15);
    color: var(--tv-technical-mint);
    font-weight: 700;
    text-transform: uppercase;
}

.plan-badge {
    font-size: 10px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

#tv-plan-badge {
    margin-top: 4px;
    font-size: 9px;
    padding: 3px 10px;
    display: inline-block;
}

.plan-badge.free {
    background: var(--tv-paper-white);
    color: var(--tv-text-light);
    border: 2px solid var(--tv-border);
}
.plan-badge.pro {
    background: var(--tv-industrial-amber);
    color: var(--tv-deep-slate);
}
.plan-badge.company {
    background: var(--tv-technical-mint);
    color: white;
}
.plan-badge.admin {
    background: var(--tv-deep-slate);
    color: var(--tv-industrial-amber);
}

.usage-bar {
    margin-top: 15px;
    padding: 12px 15px;
    background: var(--tv-paper-white);
    border-radius: var(--tv-radius-sm);
    font-size: 0.85rem;
    color: var(--tv-text-light);
    display: flex;
    align-items: center;
    white-space: nowrap;
    gap: 5px;
    padding-bottom: 15px;
    margin-bottom: 10px;
    border: 2px solid var(--tv-border);
}

.usage-bar strong {
    font-weight: 700;
    color: var(--tv-deep-slate);
}

.usage-track {
    flex: 1;
    height: 8px;
    background: rgba(44, 62, 80, 0.1);
    border-radius: 4px;
    margin: 0 10px;
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: var(--tv-technical-mint);
    width: 0%;
    transition: width 0.3s;
    border-radius: 4px;
}
.usage-fill.warning {
    background: var(--tv-industrial-amber);
}
.usage-fill.full {
    background: var(--tv-error);
}

.tv-share-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 2px solid var(--tv-border);
}

.tv-share-list-item:last-child {
    border-bottom: none;
}

.tv-share-list-item strong {
    font-size: 0.95rem;
    color: var(--tv-text);
}

.tv-share-list-item small {
    color: var(--tv-text-light);
}

.tv-share-remove-btn {
    color: var(--tv-error);
    background: rgba(231, 76, 60, 0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--tv-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: var(--tv-shadow-hard-sm);
}

.tv-share-remove-btn:hover {
    background: var(--tv-error);
    color: white;
}

.tv-project-error {
    background: rgba(231, 76, 60, 0.1);
    color: var(--tv-error);
    border: 2px solid var(--tv-error);
    padding: 12px 15px;
    border-radius: var(--tv-radius-sm);
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
}

/* --- BADGES --- */
.shared-status-badge {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    flex-shrink: 0;
}

.shared-status-badge.is-shared {
    background-color: rgba(243, 156, 18, 0.12);
    color: #b87a0a;
}

.shared-status-badge.is-shared-with-me {
    background-color: rgba(26, 188, 156, 0.12);
    color: #148f77;
}

.tv-share-list-item.is-shared {
    background-color: rgba(243, 156, 18, 0.08);
    color: var(--tv-deep-slate);
}

/* Helper to prevent body scroll when a modal is open */
body.tv-modal-open {
    overflow: hidden !important;
}

.tv-modal-open {
    overflow: hidden !important;
    height: 100% !important;
}

/* =========================================================
   TV COLLAB SYSTEM (STYLING)
   ========================================================= */

/* --- 1. Velkomst-Overlay --- */
#tv-collab-welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 62, 80, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(5px);
}

#tv-collab-welcome-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.collab-welcome-content {
    background: white;
    padding: 40px;
    border-radius: var(--tv-radius-card);
    text-align: center;
    max-width: 400px;
    position: relative;
    box-shadow: var(--tv-shadow-hard);
    border: 2px solid var(--tv-deep-slate);
    transform: translateY(20px);
    transition: transform 0.5s ease;
}

#tv-collab-welcome-overlay.show .collab-welcome-content {
    transform: translateY(0);
}

.collab-welcome-icon {
    width: 80px;
    height: 80px;
    background: var(--tv-technical-mint);
    border-radius: var(--tv-radius-card);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 40px;
    color: white;
    box-shadow: var(--tv-shadow-hard-sm);
}

.collab-close-x {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--tv-paper-white);
    border: none;
    font-size: 18px;
    color: var(--tv-text-light);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.collab-close-x:hover {
    background: var(--tv-deep-slate);
    color: var(--tv-paper-white);
}

/* --- 2. Samarbeidslinje (Nede til høyre) --- */
#collab-bar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    min-width: 200px;
    background: #ffffff;
    border: 2px solid var(--tv-deep-slate);
    border-radius: var(--tv-radius-card);
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--tv-shadow-hard);
    z-index: 99999;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.collab-bar-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.collab-status-dot {
    width: 12px;
    height: 12px;
    background: var(--tv-technical-mint);
    border-radius: 50%;
    animation: pulseCollab 2s infinite;
}

@keyframes pulseCollab {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

#collab-bar.minimized {
    min-width: 140px;
    padding: 10px 15px;
}
#collab-bar.minimized .collab-names-list {
    display: none;
}

.collab-names-list {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid var(--tv-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.collab-user-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--tv-text);
}

/* --- 3. Låsing av felt --- */
.collab-locked {
    border: 2px solid var(--tv-technical-mint) !important;
    background-color: rgba(26, 188, 156, 0.08) !important;
    cursor: not-allowed !important;
    opacity: 0.7;
}

.collab-name-tag {
    position: absolute;
    background: var(--tv-technical-mint);
    color: white;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 6px;
    pointer-events: none;
    z-index: 10000;
    box-shadow: var(--tv-shadow-hard-sm);
    white-space: nowrap;
    text-transform: uppercase;
}

/* --- 4. TOAST NOTIFICATIONS --- */
#tv-toast-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.tv-toast {
    background: #ffffff;
    color: var(--tv-text);
    padding: 16px 20px;
    border-radius: var(--tv-radius-sm);
    box-shadow: var(--tv-shadow-hard);
    border: 2px solid var(--tv-deep-slate);
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    animation: toastSlideUp 0.3s forwards;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tv-toast i {
    font-size: 1.2rem;
}

.tv-toast.type-success i {
    color: var(--tv-technical-mint);
}
.tv-toast.type-error i {
    color: var(--tv-error);
}
.tv-toast.type-warning i {
    color: var(--tv-industrial-amber);
}
.tv-toast.type-info i {
    color: var(--tv-deep-slate);
}

@keyframes toastSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes toastFadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

/* =========================================================
   MOBIL-OPTIMALISERING
   ========================================================= */

@media screen and (max-width: 768px) {

    .tv-header {
        position: relative;
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 15px;
        gap: 0;
    }

    .tv-header > div:first-child {
        width: 100%;
        flex-wrap: wrap;
        line-height: 1;
    }

    .tv-header strong {
        font-size: 1.1rem;
    }

    .tv-project-header-info {
        width: 100%;
        margin-top: 6px;
        padding-top: 8px;
        padding-left: 0 !important;
        border-left: none !important;
        border-top: 2px solid rgba(255,255,255,0.1);
        order: 3;
        font-size: 0.8rem !important;
    }

    .tv-project-header-info strong {
        font-size: 0.85rem !important;
    }

    .tv-header-right {
        position: absolute;
        top: 10px;
        right: 15px;
    }

    .tv-btn-pill.small-header-btn span {
        display: none;
    }
    .tv-btn-pill.small-header-btn {
        padding: 8px 12px;
        border-radius: 10px;
        height: 36px;
    }

    #tv-autosave-label {
        display: none !important;
    }

    .plan-badge {
        margin-left: 6px;
        font-size: 9px;
        padding: 2px 6px;
        position: relative;
        top: -1px;
    }

    /* Mobil-tilpasning for pillen: Kun dot */
    .tv-status-pill {
        background: transparent !important;
        border: none !important;
        min-width: auto !important;
        padding: 0 !important;
        gap: 0 !important;
        box-shadow: none !important;
    }
    #tv-pill-text { display: none !important; }
    .tv-pill-dot {
        width: 12px;
        height: 12px;
        margin-right: 5px !important;
    }
}

/* --- FARGE PÅ MINE LISTER KNAPP --- */
.tv-header-right .tv-btn-pill {
    background-color: var(--tv-industrial-amber);
    color: var(--tv-deep-slate);
}

.tv-header-right .tv-btn-pill:hover {
    background-color: #e67e22;
    transform: translateY(-2px);
}

/* --- 8. DEBUG PANEL --- */
#tv-debug-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 350px;
    background: var(--tv-deep-slate);
    color: var(--tv-paper-white);
    z-index: 999999;
    border-top: 4px solid var(--tv-industrial-amber);
    box-shadow: 0 -5px 20px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    font-size: 13px;
    font-family: monospace;
}

#tv-debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

#tv-debug-header strong {
    font-size: 14px;
    color: var(--tv-industrial-amber);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#tv-debug-header button {
    background: var(--tv-industrial-amber);
    color: var(--tv-deep-slate);
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: var(--tv-shadow-hard-sm);
}

#tv-debug-header button:hover {
    background: #e67e22;
}

#tv-debug-content {
    display: flex;
    flex: 1;
    min-height: 0;
    padding: 10px;
    gap: 10px;
}

.tv-debug-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--tv-radius-sm);
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.tv-debug-col strong {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    display: block;
    color: var(--tv-technical-mint);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.tv-debug-log {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column-reverse;
}

.tv-debug-log-item {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: pre-wrap;
    word-break: break-all;
}

.tv-debug-log-item:first-child {
    border-bottom: none;
}

.tv-debug-log-item strong {
    color: var(--tv-industrial-amber);
    display: inline;
    padding: 0;
    background: none;
    border: none;
}

.tv-debug-log-item .log-time {
    color: rgba(255, 255, 255, 0.4);
    margin-right: 10px;
}

/* --- COLUMN CONFIG MODAL --- */
.config-section {
    margin-bottom: 16px;
}

.config-section:last-child {
    margin-bottom: 0;
}

.config-section h4 {
    font-family: 'Barlow', system-ui, sans-serif;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--tv-text-light);
    margin: 0 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--tv-border);
}

.column-config-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--tv-radius-sm);
    margin-bottom: 6px;
    transition: opacity 0.2s, background 0.2s;
}

.column-config-row.detected {
    background: rgba(26, 188, 156, 0.08);
    border: 1px solid rgba(26, 188, 156, 0.2);
}

.col-original {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: var(--tv-paper-white);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--tv-border);
    color: var(--tv-text);
    white-space: nowrap;
}

.col-arrow {
    color: var(--tv-text-light);
    font-size: 14px;
    flex-shrink: 0;
}

.col-detected {
    font-size: 13px;
    font-weight: 600;
    color: var(--tv-accent-secondary);
    white-space: nowrap;
}

.col-detected i {
    margin-right: 4px;
}

.column-config-row.editable {
    background: var(--tv-card-bg);
    border: 1px solid var(--tv-border);
}

.column-config-row.editable.disabled {
    opacity: 0.4;
}

.column-config-row.editable.disabled .col-config-fields input {
    pointer-events: none;
}

.col-enable {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.col-enable input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--tv-accent-secondary);
}

.col-original-text {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: var(--tv-paper-white);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--tv-border);
    color: var(--tv-text);
    white-space: nowrap;
    flex-shrink: 0;
}

.col-config-fields {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.col-field {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.col-field label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--tv-text-light);
    margin-bottom: 2px;
}

.col-name-input,
.col-unit-input {
    padding: 6px 10px;
    border: 1px solid var(--tv-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Barlow', system-ui, sans-serif;
    background: white;
    color: var(--tv-text);
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.col-name-input:focus,
.col-unit-input:focus {
    outline: none;
    border-color: var(--tv-accent-secondary);
    box-shadow: 0 0 0 2px rgba(26, 188, 156, 0.15);
}

.col-unit-input {
    max-width: 90px;
    flex-shrink: 0;
}

@media (max-width: 500px) {
    .column-config-row.editable {
        flex-wrap: wrap;
    }
    .col-config-fields {
        width: 100%;
        margin-top: 4px;
    }
}

/* --- FONT IMPORT --- */
@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@500;600;700;800&display=swap');
