/* ═══════════════════════════════════════════════════════════════════════════════
 *  AT·OM VIEW MODES — Styles spécifiques aux modes de navigation
 *
 *  Mode Classic:      Comportement existant (dock + bureau zones grid)
 *  Mode Isometric:    Vue MMORPG 2.5D des 9 pièces (sphères)
 *  Mode Mobile Cards: Navigation condensée par cartes (téléphone)
 * ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── Variables isométriques ───────────────────────────────────────────────── */
:root {
    --iso-room-w: 180px;
    --iso-room-h: 140px;
    --iso-gap: 12px;
    --iso-floor-w: 576px;   /* 3 * (180 + 12) */
    --iso-floor-h: 432px;   /* 3 * (140 + 12) */
    --iso-transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --iso-hover-lift: 16px;
}


/* ═══════════════════════════════════════════════════════════════════════════════
 *  MODE SELECTOR (topbar popover)
 * ═══════════════════════════════════════════════════════════════════════════════ */

.viewmode-selector {
    position: fixed;
    z-index: 1000;
    background: var(--surface, #111118);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 6px;
    min-width: 180px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    animation: fadeInUp 0.15s ease;
}

.viewmode-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.viewmode-option:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.viewmode-option.active {
    background: rgba(212,175,55,0.12);
    color: var(--or, #D4AF37);
}

.viewmode-option-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.viewmode-option-label {
    flex: 1;
}

.viewmode-check {
    color: var(--or, #D4AF37);
    font-weight: 600;
}


/* ═══════════════════════════════════════════════════════════════════════════════
 *  ISOMETRIC VIEW — Vue plancher MMORPG
 * ═══════════════════════════════════════════════════════════════════════════════ */

#isometric-view {
    display: none;
    flex: 1;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 0;
    perspective: 1200px;
}

/* Le sol isométrique */
#iso-floor {
    position: relative;
    width: var(--iso-floor-w);
    height: var(--iso-floor-h);
    transform: rotateX(55deg) rotateZ(-45deg);
    transform-style: preserve-3d;
    will-change: transform;
    transition: transform var(--iso-transition);
}

/* Quand on entre dans une pièce — zoom */
#iso-floor.room-entered {
    transform: rotateX(0deg) rotateZ(0deg) scale(1);
}

/* ─── Pièces (rooms = sphères) ──────────────────────────────────────────── */

.iso-room {
    position: absolute;
    width: var(--iso-room-w);
    height: var(--iso-room-h);
    background: linear-gradient(145deg, rgba(20,20,35,0.9), rgba(15,15,25,0.95));
    border: 2px solid var(--sphere-color, rgba(255,255,255,0.15));
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition:
        transform var(--iso-transition),
        box-shadow var(--iso-transition),
        border-color 0.3s,
        filter 0.3s,
        opacity 0.3s;
    contain: layout style paint;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.iso-room::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 6px;
    background: radial-gradient(circle at 50% 30%, var(--sphere-color-alpha, rgba(99,102,241,0.08)), transparent 70%);
    pointer-events: none;
}

.iso-room:hover {
    transform: translateZ(var(--iso-hover-lift));
    box-shadow:
        0 var(--iso-hover-lift) 40px rgba(0,0,0,0.5),
        0 0 24px var(--sphere-color-glow, rgba(99,102,241,0.2));
    border-color: var(--sphere-color, #6366F1);
}

.iso-room.active {
    border-color: var(--sphere-color, #6366F1);
    box-shadow:
        0 4px 20px rgba(0,0,0,0.3),
        0 0 16px var(--sphere-color-glow, rgba(99,102,241,0.3)),
        inset 0 0 20px var(--sphere-color-alpha, rgba(99,102,241,0.05));
}

/* Room contents */
.room-icon {
    font-size: 2rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.room-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    text-align: center;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    letter-spacing: 0.01em;
}

.room-activity {
    display: flex;
    gap: 6px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
}

.room-activity-badge {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255,255,255,0.06);
    padding: 2px 6px;
    border-radius: 10px;
}


/* ─── Pièce verrouillée ─────────────────────────────────────────────────── */

.iso-room.locked {
    filter: grayscale(1) brightness(0.5);
    opacity: 0.45;
    cursor: pointer;
}

.iso-room.locked:hover {
    filter: grayscale(0.6) brightness(0.6);
    opacity: 0.6;
    transform: translateZ(4px);
}

.room-lock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    background: rgba(0,0,0,0.4);
    border-radius: 6px;
    pointer-events: none;
}


/* ─── Sprint 2 : Place-type styles ──────────────────────────────────────── */

/* Sphère (default — pas de style supplémentaire, c'est le style de base) */

/* Entité — bordure double corporate */
.iso-room[data-place-type="entity"] {
    border-style: double;
    border-width: 3px;
}

/* Public — coins arrondis, plus ouvert */
.iso-room[data-place-type="public"] {
    border-radius: 16px;
}
.iso-room[data-place-type="public"]::before {
    border-radius: 14px;
}

/* Utilitaire — bordure dashed, légèrement transparent */
.iso-room[data-place-type="utility"] {
    border-style: dashed;
    opacity: 0.85;
}

/* Communauté — coins arrondis doux */
.iso-room[data-place-type="community"] {
    border-radius: 14px;
}
.iso-room[data-place-type="community"]::before {
    border-radius: 12px;
}

/* Réunion — cercle + bordure dotted */
.iso-room[data-place-type="meeting"] {
    border-radius: 50%;
    border-style: dotted;
    border-width: 2px;
}
.iso-room[data-place-type="meeting"]::before {
    border-radius: 50%;
}

/* Échange — accent diamant (rotation 45deg du pseudo-element) */
.iso-room[data-place-type="exchange"] {
    border-radius: 4px;
}
.iso-room[data-place-type="exchange"]::after {
    content: '◇';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.8rem;
    color: var(--sphere-color, rgba(255,255,255,0.3));
    pointer-events: none;
}

/* Preview popup type badge */
.preview-type {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    padding: 1px 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    margin-left: auto;
}


/* ─── Sprint 2 : Environment transition ────────────────────────────────── */

#iso-floor.env-transitioning {
    opacity: 0.3;
    transform: rotateX(55deg) rotateZ(-45deg) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
}


/* ─── Ambiance Monde ────────────────────────────────────────────────────── */

#isometric-view[data-monde="mon_monde"] #iso-floor {
    filter: hue-rotate(-10deg);
}
#isometric-view[data-monde="mon_monde"] .iso-room::before {
    background: radial-gradient(circle at 50% 30%, rgba(30,58,95,0.15), transparent 70%);
}

#isometric-view[data-monde="notre_monde"] #iso-floor {
    filter: sepia(0.1) saturate(1.2);
}
#isometric-view[data-monde="notre_monde"] .iso-room::before {
    background: radial-gradient(circle at 50% 30%, rgba(216,178,106,0.1), transparent 70%);
}

#isometric-view[data-monde="le_monde"] #iso-floor {
    filter: hue-rotate(10deg) saturate(1.1);
}
#isometric-view[data-monde="le_monde"] .iso-room::before {
    background: radial-gradient(circle at 50% 30%, rgba(34,197,94,0.1), transparent 70%);
}


/* ─── Preview popup ─────────────────────────────────────────────────────── */

#iso-preview {
    position: fixed;
    z-index: 500;
    background: var(--surface, #111118);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 14px 18px;
    min-width: 200px;
    max-width: 300px;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

#iso-preview.visible {
    opacity: 1;
    transform: translateY(0);
}

.preview-header {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
}

.preview-locked {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
}

.preview-lock-icon {
    font-size: 1.5rem;
}

.preview-hint {
    font-size: 0.8rem;
    color: rgba(212,175,55,0.6);
}


/* ─── Canvas overlay ────────────────────────────────────────────────────── */

#iso-canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}


/* ─── Intérieur de pièce (mobilier / zones bureau) ──────────────────────── */

#iso-room-interior {
    display: none;
    position: absolute;
    inset: 0;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(10,10,20,0.98), rgba(15,15,30,0.98));
    z-index: 10;
    animation: roomFadeIn 0.35s ease;
}

#iso-room-interior.visible {
    display: flex;
}

@keyframes roomFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.room-interior-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.room-back-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}

.room-back-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.room-interior-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.room-furniture-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    padding: 12px;
    flex: 1;
    min-height: 0;
}

.iso-furniture {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 16px 10px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    contain: layout style;
    position: relative;
}

.iso-furniture:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.18);
    transform: translateY(-2px);
}

.furniture-sprite {
    font-size: 1.6rem;
}

.furniture-label {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.65);
    text-align: center;
}

.furniture-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--or, #D4AF37);
    color: #000;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}


/* ═══════════════════════════════════════════════════════════════════════════════
 *  MOBILE CARDS MODE — Navigation condensée
 * ═══════════════════════════════════════════════════════════════════════════════ */

#mobile-cards-view {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
    gap: 6px;
}

/* Indicateur de swipe */
.mobile-swipe-hint {
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    padding: 4px 0;
}

/* Carte sphère active (grande) */
.mobile-sphere-card {
    background: var(--surface, #111118);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.25s ease;
}

.mobile-sphere-card.active {
    border-color: var(--sphere-color, rgba(99,102,241,0.4));
}

.mobile-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
}

.mobile-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-card-icon {
    font-size: 1.3rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
}

.mobile-card-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
}

.mobile-card-progress {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
}

/* Zones en liste compacte (visible quand carte active) */
.mobile-zone-list {
    display: none;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.mobile-sphere-card.active .mobile-zone-list {
    display: block;
}

.mobile-zone-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background 0.15s;
}

.mobile-zone-item:hover {
    background: rgba(255,255,255,0.04);
}

.mobile-zone-item:last-child {
    border-bottom: none;
}

.mobile-zone-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-zone-icon {
    font-size: 1rem;
    width: 28px;
    text-align: center;
}

.mobile-zone-name {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
}

.mobile-zone-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mobile-zone-badge {
    background: rgba(212,175,55,0.15);
    color: var(--or, #D4AF37);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
}

.mobile-zone-arrow {
    color: rgba(255,255,255,0.55);
    font-size: 0.8rem;
}

/* Carte verrouillée */
.mobile-sphere-card.locked {
    opacity: 0.4;
}

.mobile-sphere-card.locked .mobile-card-header {
    cursor: pointer;
}

/* Section "plus de pièces" */
.mobile-more-rooms {
    text-align: center;
    padding: 10px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
}

/* Bottom bar simplifié mobile */
.mobile-bottom-bar {
    display: none;
    align-items: center;
    justify-content: space-around;
    padding: 8px 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: var(--surface, #111118);
}

.mobile-bottom-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 12px;
}

.mobile-bottom-btn.active {
    color: var(--or, #D4AF37);
}

.mobile-bottom-label {
    font-size: 0.8rem;
}


/* ═══════════════════════════════════════════════════════════════════════════════
 *  MODE-CONDITIONAL VISIBILITY
 * ═══════════════════════════════════════════════════════════════════════════════ */

/* Isometric mode : masquer les docks sur petit écran (l'iso suffit) */
#desktop-shell[data-view-mode="mobile_cards"] #dock-left,
#desktop-shell[data-view-mode="mobile_cards"] #dock-right {
    display: none;
}

#desktop-shell[data-view-mode="mobile_cards"] #immersive-taskbar {
    display: none;
}

#desktop-shell[data-view-mode="mobile_cards"] #page-nav-bar {
    display: none;
}

#desktop-shell[data-view-mode="mobile_cards"] .mobile-bottom-bar {
    display: flex;
}


/* ═══════════════════════════════════════════════════════════════════════════════
 *  RESPONSIVE OVERRIDES
 * ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
    :root {
        --iso-room-w: 150px;
        --iso-room-h: 120px;
        --iso-floor-w: 486px;
        --iso-floor-h: 396px;
    }
    .room-icon { font-size: 1.6rem; }
    .room-label { font-size: 0.8rem; }
}

@media (max-width: 900px) {
    :root {
        --iso-room-w: 120px;
        --iso-room-h: 100px;
        --iso-gap: 8px;
        --iso-floor-w: 384px;
        --iso-floor-h: 324px;
    }
    .room-icon { font-size: 1.3rem; }
    .room-label { font-size: 0.8rem; }
    .room-activity { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
 *  SPRINT 3 — Create Place Tile (+)
 * ═══════════════════════════════════════════════════════════════════════════════ */

.iso-room-add {
    border: 2px dashed rgba(255,255,255,0.15) !important;
    background: rgba(255,255,255,0.02) !important;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: border-color 0.2s, background 0.2s;
}

.iso-room-add:hover {
    border-color: rgba(212,175,55,0.4) !important;
    background: rgba(212,175,55,0.06) !important;
}

.mobile-card-add {
    border: 2px dashed rgba(255,255,255,0.12) !important;
    cursor: pointer;
    transition: border-color 0.2s;
}

.mobile-card-add:hover {
    border-color: rgba(212,175,55,0.3) !important;
}


/* ═══════════════════════════════════════════════════════════════════════════════
 *  SPRINT 3 — Preview Agents
 * ═══════════════════════════════════════════════════════════════════════════════ */

.preview-agents {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.preview-agent {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
}

.preview-agent-more {
    font-size: 0.8rem;
    color: rgba(212,175,55,0.6);
    font-style: italic;
}


/* ═══════════════════════════════════════════════════════════════════════════════
 *  SPRINT 3 — Interior Sections (Agents + Threads)
 * ═══════════════════════════════════════════════════════════════════════════════ */

.interior-section {
    padding: 10px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.interior-section-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    margin-bottom: 8px;
}

.interior-agents-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.interior-agent {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.interior-agent:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(212,175,55,0.3);
}

.agent-affinity {
    font-size: 0.8rem;
    color: rgba(212,175,55,0.6);
    margin-left: 4px;
}

.interior-threads-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.interior-thread {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.interior-thread:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
}

.thread-icon {
    font-size: 1rem;
}

.thread-name {
    flex: 1;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8);
}

.thread-agent-count {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
}

.thread-status {
    font-size: 0.8rem;
}

.thread-status-badge {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    margin-left: auto;
}

.interior-create-thread-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    background: rgba(212,175,55,0.08);
    border: 1px dashed rgba(212,175,55,0.3);
    border-radius: 8px;
    color: rgba(212,175,55,0.7);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}

.interior-create-thread-btn:hover {
    background: rgba(212,175,55,0.15);
}

.interior-thread-limit {
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    padding: 8px 0;
}

.interior-empty {
    text-align: center;
    color: rgba(255,255,255,0.55);
    font-size: 0.8rem;
    padding: 12px 0;
}


/* ═══════════════════════════════════════════════════════════════════════════════
 *  SPRINT 3 — Modal (Create Place / Thread)
 * ═══════════════════════════════════════════════════════════════════════════════ */

.iso-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.iso-modal {
    background: #111118;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    width: 420px;
    max-width: 92vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    animation: modalSlideUp 0.2s ease;
}

.iso-modal-sm {
    width: 340px;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.iso-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-weight: 600;
    font-size: 0.95rem;
}

.iso-modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.55);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.iso-modal-close:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
}

.iso-modal-body {
    padding: 16px 20px;
}

.iso-modal-label {
    display: block;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 6px;
    margin-top: 14px;
}

.iso-modal-label:first-child {
    margin-top: 0;
}

.iso-modal-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 10px 12px;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}

.iso-modal-input:focus {
    border-color: rgba(212,175,55,0.5);
}

.iso-modal-input::placeholder {
    color: rgba(255,255,255,0.25);
}

.iso-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.iso-modal-btn {
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    border: none;
}

.iso-modal-btn.secondary {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.7);
}

.iso-modal-btn.secondary:hover {
    background: rgba(255,255,255,0.1);
}

.iso-modal-btn.primary {
    background: rgba(212,175,55,0.2);
    color: #D4AF37;
}

.iso-modal-btn.primary:hover:not(:disabled) {
    background: rgba(212,175,55,0.3);
}

.iso-modal-btn.primary:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Type / Color / Icon grids */
.create-type-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.create-type-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 6px 12px;
    color: rgba(255,255,255,0.65);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.create-type-btn:hover {
    background: rgba(255,255,255,0.08);
}

.create-type-btn.selected {
    border-color: rgba(212,175,55,0.5);
    background: rgba(212,175,55,0.1);
    color: #D4AF37;
}

.create-color-grid {
    display: flex;
    gap: 6px;
}

.create-color-btn {
    width: 28px;
    height: 28px;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}

.create-color-btn:hover {
    transform: scale(1.15);
}

.create-color-btn.selected {
    border-color: #fff;
    transform: scale(1.15);
}

.create-icon-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.create-icon-btn {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.create-icon-btn:hover {
    background: rgba(255,255,255,0.08);
}

.create-icon-btn.selected {
    border-color: rgba(212,175,55,0.5);
    background: rgba(212,175,55,0.1);
}


/* ═══════════════════════════════════════════════════════════════════════════════
 *  SPRINT 4 — Membrane Inter-Mondes
 * ═══════════════════════════════════════════════════════════════════════════════ */

.membrane-interior {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 16px 16px;
    flex: 1;
}

.membrane-mondes {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    flex: 1;
    min-height: 150px;
}

.membrane-monde-col {
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 10px;
    overflow-y: auto;
}

.membrane-monde-header {
    font-weight: 700;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 8px;
    text-align: center;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.membrane-monde-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.membrane-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    border: 1px solid transparent;
    font-size: 0.8rem;
}

.membrane-item:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(212,175,55,0.2);
}

.membrane-item-name {
    flex: 1;
    color: rgba(255,255,255,0.75);
}

.membrane-item-threads {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
}

.membrane-passages {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 10px;
}

.membrane-passage {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
    margin-bottom: 4px;
    background: rgba(255,255,255,0.02);
}

.membrane-passage-type {
    color: rgba(255,255,255,0.6);
    font-style: italic;
}

.membrane-passage-arrow {
    color: var(--sacred-gold, #D8B26A);
    font-weight: bold;
}

.membrane-passage-perm {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    margin-left: auto;
}

.membrane-revoke-btn {
    background: rgba(255,80,80,0.15);
    border: 1px solid rgba(255,80,80,0.2);
    color: #ff8888;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.membrane-revoke-btn:hover {
    background: rgba(255,80,80,0.3);
}

/* Membrane Wizard */
.membrane-wizard-source {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
}

.membrane-wizard-from {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    margin-left: auto;
}

.membrane-wizard-targets,
.membrane-wizard-perms {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.membrane-wizard-target,
.membrane-wizard-perm {
    flex: 1;
    padding: 10px 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 0.8rem;
    text-align: center;
    transition: all 0.15s;
}

.membrane-wizard-target:hover,
.membrane-wizard-perm:hover {
    background: rgba(255,255,255,0.08);
}

.membrane-wizard-target.selected,
.membrane-wizard-perm.selected {
    border-color: rgba(212,175,55,0.5);
    background: rgba(212,175,55,0.1);
    color: rgba(255,255,255,0.9);
}


/* ═══════════════════════════════════════════════════════════════════════════════
 *  SPRINT 4 — Governance Dashboard
 * ═══════════════════════════════════════════════════════════════════════════════ */

.gov-dashboard {
    display: flex;
    height: 100%;
    background: rgba(0,0,0,0.15);
}

.gov-sidebar {
    width: 38.2%; /* 1 - PHI_INV */
    border-right: 1px solid rgba(255,255,255,0.08);
    overflow-y: auto;
    padding: 0;
}

.gov-main {
    width: 61.8%; /* PHI_INV */
    overflow-y: auto;
    padding: 16px 20px;
}

.gov-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.gov-sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    margin-bottom: 4px;
}

.gov-sidebar-subtitle {
    font-size: 0.8rem;
    color: rgba(212,175,55,0.6);
}

.gov-branch-list {
    display: flex;
    flex-direction: column;
}

.gov-branch-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.gov-branch-tab:hover {
    background: rgba(255,255,255,0.04);
}

.gov-branch-tab.active {
    background: rgba(255,255,255,0.06);
    border-left-color: var(--sacred-gold, #D8B26A);
}

.gov-branch-icon {
    font-size: 1.3em;
}

.gov-branch-info {
    flex: 1;
}

.gov-branch-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
}

.gov-branch-count {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
}

.gov-branch-bar-wrap {
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}

.gov-branch-bar {
    height: 100%;
    background: var(--sacred-gold, #D8B26A);
    border-radius: 2px;
    transition: width 0.3s;
}

.gov-roster-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.gov-roster-icon {
    font-size: 1.4em;
}

.gov-roster-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
}

.gov-roster-count {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    margin-left: auto;
}

.gov-roster-desc {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    margin-bottom: 16px;
}

.gov-roster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.gov-agent-card {
    padding: 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.gov-agent-card:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(212,175,55,0.3);
}

.gov-agent-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.gov-agent-icon {
    font-size: 1.2em;
}

.gov-agent-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
}

.gov-agent-role {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 6px;
}

.gov-agent-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

.gov-agent-sphere {
    font-size: 0.8rem;
    color: rgba(212,175,55,0.6);
    background: rgba(212,175,55,0.08);
    padding: 1px 6px;
    border-radius: 3px;
}

.gov-agent-level {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
}

.gov-agent-caps {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    font-style: italic;
    margin-top: 4px;
}

.gov-stats {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.gov-stats-row {
    display: flex;
    gap: 8px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.gov-stats-bar {
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}

.gov-stats-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}


/* ═══════════════════════════════════════════════════════════════════════════════
 *  SPRINT 4 — Thread Execution (Tasks + Progress PHI)
 * ═══════════════════════════════════════════════════════════════════════════════ */

.thread-progress-container {
    margin-bottom: 12px;
}

.thread-progress-bar {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    position: relative;
    overflow: visible;
}

.thread-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.thread-progress-phi-mark {
    position: absolute;
    left: 61.8%;
    top: -4px;
    width: 2px;
    height: 16px;
    background: rgba(212,175,55,0.7);
    border-radius: 1px;
    z-index: 1;
}

.thread-progress-stats {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    margin-top: 4px;
    text-align: right;
}

.thread-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.thread-task {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    transition: background 0.15s;
}

.thread-task:hover {
    background: rgba(255,255,255,0.06);
}

.thread-task-status {
    cursor: pointer;
    font-size: 1.1em;
    user-select: none;
    transition: transform 0.15s;
}

.thread-task-status:hover {
    transform: scale(1.2);
}

.thread-task-icon {
    font-size: 0.9em;
}

.thread-task-title {
    flex: 1;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8);
}

.thread-task-agent {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.04);
    padding: 2px 6px;
    border-radius: 4px;
}

.thread-task-completed .thread-task-title {
    text-decoration: line-through;
    opacity: 0.4;
}

.thread-task-completed .thread-task-icon {
    opacity: 0.4;
}

.thread-task-limit {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    text-align: center;
    padding: 8px;
    font-style: italic;
}

.thread-add-task-btn {
    width: 100%;
    padding: 8px 12px;
    margin-top: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px dashed rgba(255,255,255,0.12);
    border-radius: 6px;
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.thread-add-task-btn:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(212,175,55,0.3);
    color: rgba(255,255,255,0.7);
}

.thread-task-inline-form {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.thread-task-input {
    flex: 1;
    padding: 6px 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: white;
    font-size: 0.8rem;
    outline: none;
}

.thread-task-input:focus {
    border-color: rgba(212,175,55,0.5);
}

.thread-task-confirm-btn,
.thread-task-cancel-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.thread-task-confirm-btn {
    background: rgba(74,222,128,0.2);
    color: #4ade80;
}

.thread-task-confirm-btn:hover {
    background: rgba(74,222,128,0.3);
}

.thread-task-cancel-btn {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.5);
}

.thread-task-cancel-btn:hover {
    background: rgba(255,255,255,0.1);
}


/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .iso-room,
    #iso-floor,
    #iso-preview,
    #iso-room-interior,
    .iso-furniture,
    .iso-modal,
    .iso-modal-overlay {
        transition: none !important;
        animation: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SPRINT 5 — LIGHT MODE (Isometric + Interior + Governance + Membrane)
   ═══════════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] .isometric-container { background: linear-gradient(135deg, #e0e5ec, #cdd5df); }
[data-theme="light"] #iso-floor { opacity: 0.15; }
[data-theme="light"] .iso-room { border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .iso-room-label { color: #1d1d1f; text-shadow: 0 1px 3px rgba(255,255,255,0.8); }
[data-theme="light"] #iso-room-interior {
    background: rgba(255,255,255,0.95); color: #1d1d1f;
    border: 1px solid rgba(0,0,0,0.1); box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
[data-theme="light"] .interior-agent { color: #1d1d1f; }
[data-theme="light"] .interior-agent:hover { background: rgba(0,0,0,0.05); }
[data-theme="light"] .interior-thread { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); color: #1d1d1f; }
[data-theme="light"] .interior-thread:hover { background: rgba(0,0,0,0.06); }
[data-theme="light"] .interior-create-thread-btn { background: rgba(0,102,204,0.08); color: #0066CC; border-color: rgba(0,102,204,0.2); }

/* Governance Dashboard light */
[data-theme="light"] .gov-dashboard { background: #f5f5f7; color: #1d1d1f; }
[data-theme="light"] .gov-sidebar { background: #eeeff1; border-right-color: rgba(0,0,0,0.08); }
[data-theme="light"] .gov-branch-tab { color: #1d1d1f; }
[data-theme="light"] .gov-branch-tab:hover { background: rgba(0,0,0,0.04); }
[data-theme="light"] .gov-branch-tab.active { background: rgba(0,0,0,0.06); border-left-color: #A07818; }
[data-theme="light"] .gov-agent-card { background: rgba(0,0,0,0.03); color: #1d1d1f; }
[data-theme="light"] .gov-agent-card:hover { background: rgba(0,0,0,0.06); }
[data-theme="light"] .gov-stats { color: #6e6e73; }

/* Membrane light */
[data-theme="light"] .membrane-monde-col { background: rgba(0,0,0,0.02); }
[data-theme="light"] .membrane-item { background: rgba(0,0,0,0.03); color: #1d1d1f; }
[data-theme="light"] .membrane-item:hover { background: rgba(0,0,0,0.06); }
[data-theme="light"] .membrane-passages { border-top-color: rgba(0,0,0,0.08); }

/* Thread tasks light */
[data-theme="light"] .thread-progress-bar { background: rgba(0,0,0,0.06); }
[data-theme="light"] .thread-task { color: #1d1d1f; }
[data-theme="light"] .thread-task:hover { background: rgba(0,0,0,0.04); }

/* Mobile cards light */
[data-theme="light"] .mobile-card { background: #ffffff; border-color: rgba(0,0,0,0.08); color: #1d1d1f; }
