body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

#map {
    width: 100%;
    height: 100vh;
}

#info {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1300; /* por encima de Buscar y menú de cuenta */
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    max-width: 360px;
    max-height: 80vh;
    overflow-y: auto;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#info.panel-colapsado {
    display: none;
}

#btn-abrir-panel {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

#btn-abrir-panel[hidden] {
    display: none !important;
}

#btn-cerrar-panel {
    float: right;
    border: 1px solid #ddd;
    background: #f8f8f8;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
    color: #555;
}

#auth-box {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1200;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    min-width: 0;
    font-size: 13px;
}

.btn-user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 8px 14px 8px 10px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    font-size: 13px;
    max-width: 260px;
}

.btn-user-menu:hover {
    background: #fafafa;
}

.user-menu-avatar {
    font-size: 16px;
}

.user-menu-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: #222;
}

.user-menu-caret {
    color: #888;
    font-size: 11px;
}

.user-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 8px 0;
    z-index: 1001;
}

.user-menu-panel[hidden] {
    display: none !important;
}

.user-menu-header {
    padding: 8px 14px 10px;
    border-bottom: 1px solid #eee;
    margin-bottom: 4px;
}

.user-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 10px 14px;
    font-size: 13px;
    cursor: pointer;
    color: #222;
}

.user-menu-item:hover {
    background: #f5f5f5;
}

.user-menu-item.user-menu-danger {
    color: #c0392b;
}

.user-menu-hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 6px 0;
}

.sec-highlight {
    background: #fff8d6;
    border-radius: 4px;
    transition: background 1.2s ease;
}


#auth-box input {
    width: 100%;
    box-sizing: border-box;
    margin: 4px 0 8px;
    padding: 6px 8px;
    font-size: 13px;
}

#auth-box button {
    margin: 2px 4px 2px 0;
}

#auth-box .auth-error {
    color: #c0392b;
    font-size: 12px;
    margin-top: 6px;
}

#auth-box .auth-ok {
    color: #27ae60;
    font-weight: bold;
}

.punto {
    margin: 10px 0;
    padding-top: 8px;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.punto-info {
    flex: 1;
    min-width: 0;
}

.punto-img {
    width: 48px;
    height: auto;
    flex-shrink: 0;
    image-rendering: pixelated;
}

.punto-ajeno {
    opacity: 0.85;
    border-left: 3px solid #95a5a6;
    padding-left: 6px;
}

.punto-propio {
    border-left: 3px solid #f1c40f;
    padding-left: 6px;
}

.usuario-tag {
    font-size: 11px;
    color: #7f8c8d;
}

.tiempo {
    color: #c0392b;
    font-weight: bold;
    font-size: 14px;
}

.precio-original {
    color: #999;
    text-decoration: line-through;
    text-decoration-color: #e74c3c;
    text-decoration-thickness: 2px;
}

.precio-oferta {
    color: #27ae60;
    font-weight: bold;
    margin-left: 6px;
}

.porcentaje-oferta {
    color: #e67e22;
    font-size: 12px;
    margin-left: 4px;
}

.btn-nota {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 0 2px;
    vertical-align: middle;
}

.globo-nota {
    display: inline-block;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 2px 8px;
    font-size: 12px;
    color: #856404;
    margin-left: 4px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    position: relative;
}

.globo-nota::after {
    content: '';
    position: absolute;
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #ffc107;
}

button {
    margin: 3px 3px 0 0;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
}

/* ----- Modales ----- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

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

.modal-box {
    background: #fff;
    border-radius: 10px;
    padding: 16px 18px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-box h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

.modal-box label {
    display: block;
    font-size: 12px;
    color: #555;
    margin: 10px 0 4px;
}

.modal-box input[type="text"],
.modal-box input[type="number"],
.modal-box input[type="datetime-local"] {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.modal-box .field-error {
    color: #c0392b;
    font-size: 12px;
    margin-top: 6px;
    min-height: 1.2em;
}

.modal-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 13px;
}

.modal-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-actions button {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 4px;
    border: 1px solid #bbb;
    background: #f5f5f5;
}

.modal-ok {
    background: #f1c40f !important;
    border-color: #d4ac0d !important;
    font-weight: bold;
}

.modal-msg {
    font-size: 14px;
    line-height: 1.45;
    margin: 0;
}


/* ----- Panel colapsable por punto ----- */
.punto-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
}

.punto-header:hover {
    opacity: 0.9;
}

.punto-chevron {
    flex-shrink: 0;
    font-size: 12px;
    color: #666;
    transition: transform 0.15s ease;
    margin-top: 2px;
}

.punto.expandido .punto-chevron {
    transform: rotate(90deg);
}

.punto-detalles {
    display: none;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #eee;
}

.punto.expandido .punto-detalles {
    display: block;
}

.punto.resaltado {
    outline: 2px solid #f1c40f;
    outline-offset: 2px;
    border-radius: 4px;
    background: #fffbeb;
}


/* Avatar a la izquierda del título */
.punto-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 8px;
    background: #f4f4f4;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    overflow: hidden;
}

.punto-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.punto-header-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.punto-header-text {
    flex: 1;
    min-width: 0;
}



.panel-vacio {
    margin-top: 12px;
    padding: 8px 0;
}

.punto-detalles {
    display: block;
}


.modal-hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 14px 0;
}

.modal-section {
    font-weight: bold;
    font-size: 13px;
    margin: 0 0 6px;
}

.modal-inline-btn {
    margin-top: 10px;
    width: 100%;
    padding: 8px;
    background: #f1c40f;
    border: 1px solid #d4ac0d;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}


/* ----- Pantalla de login ----- */
#login-screen {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    background: #f7f7f7;
}

#login-screen[hidden] {
    display: none !important;
}

.login-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #ffffff;
}

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Oscuro a la derecha → se funde con el blanco de la izquierda */
    background: linear-gradient(to left, #1a252f 0%, #2c3e50 35%, #aeb6bf 70%, #ffffff 100%);
    padding: 24px;
}

.login-villager {
    max-width: min(288px, 63%); /* ~10% más pequeño que 320px / 70% */
    height: auto;
    image-rendering: pixelated;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.35));
}

.login-card {
    width: 100%;
    max-width: 340px;
}

.login-brand {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px 14px;
    margin-bottom: 8px;
}

.login-title {
    margin: 0;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #f1c40f;
}

.login-slogan {
    margin: 0;
    font-size: 14px;
    color: #555;
    font-style: italic;
}

.login-sub {
    margin: 0 0 20px;
    color: #666;
    font-size: 14px;
}

.login-card label {
    display: block;
    font-size: 12px;
    color: #555;
    margin: 10px 0 4px;
}

.login-card input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.login-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.login-actions button {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-primary {
    background: #f1c40f;
    border: 1px solid #d4ac0d;
    font-weight: bold;
}

.btn-secondary {
    background: #ecf0f1;
    border: 1px solid #bdc3c7;
}

#app-shell {
    position: relative;
    width: 100%;
    height: 100vh;
}

#app-shell[hidden] {
    display: none !important;
}

#app-shell #map {
    width: 100%;
    height: 100vh;
}

@media (max-width: 720px) {
    #login-screen {
        flex-direction: column-reverse;
    }
    .login-right {
        min-height: 180px;
        flex: 0 0 auto;
    }
    .login-villager {
        max-width: 120px;
    }
}


.panel-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.panel-tab {
    flex: 1;
    padding: 6px 8px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f5f5f5;
    cursor: pointer;
}

.panel-tab.active {
    background: #f1c40f;
    border-color: #d4ac0d;
    font-weight: bold;
}

.panel-tab-body {
    margin-bottom: 8px;
    font-size: 13px;
}

.aviso-item {
    margin: 6px 0;
    padding: 6px 8px;
    background: #fff8e6;
    border-left: 3px solid #f1c40f;
    border-radius: 0 4px 4px 0;
    font-size: 12px;
    line-height: 1.35;
}

.panel-acciones {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #eee;
}


.historial-lista {
    max-height: 220px;
    overflow-y: auto;
    margin-top: 8px;
}

.historial-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    padding: 8px;
    margin-bottom: 6px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #eee;
    font-size: 12px;
}

.historial-item-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.historial-item-actions button {
    font-size: 11px;
    padding: 4px 6px;
    white-space: nowrap;
}


.punto-img-wrap {
    position: relative;
    flex-shrink: 0;
    width: 48px;
}

.punto-img-wrap .punto-img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
    image-rendering: auto;
}

.punto-img-wrap .punto-img.pixel {
    image-rendering: pixelated;
}

.punto-img-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    color: #fff;
    text-align: center;
    padding: 2px;
    line-height: 1.2;
    font-weight: bold;
}

.punto-img-wrap.editable:hover .punto-img-overlay {
    display: flex;
}


.punto-avatar-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
}

.punto-avatar-wrap .punto-avatar {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
}

.punto-avatar-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

.punto-avatar-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 9px;
    font-weight: bold;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
}

.punto-avatar-wrap.editable {
    cursor: pointer;
}

.punto-avatar-wrap.editable:hover .punto-avatar-overlay {
    display: flex;
}


.rol-switch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.rol-label {
    font-size: 13px;
    color: #888;
}

.rol-label.rol-active {
    color: #222;
    font-weight: bold;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #f1c40f;
    transition: 0.2s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.switch input:checked + .slider {
    background-color: #f1c40f;
}

.switch input:not(:checked) + .slider {
    background-color: #95a5a6;
}

.switch input:checked + .slider:before {
    transform: translateX(20px);
}


.panel-tab.btn-seguir {
    flex: 0 0 auto;
    background: #ecf0f1;
    border-color: #bdc3c7;
    white-space: nowrap;
}

.panel-tab.btn-seguir:hover {
    background: #d5dbdb;
}

.panel-tab.btn-seguir.siguiendo {
    background: #d5f5e3;
    border-color: #27ae60;
    color: #1e8449;
}

#auth-logged {
    position: relative;
}


.panel-chrome {
    flex-shrink: 0;
    padding: 12px 14px 10px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.panel-chrome-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.panel-chrome-title {
    font-weight: bold;
    font-size: 14px;
}

#btn-cerrar-panel {
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: #555;
    flex-shrink: 0;
}

#btn-cerrar-panel:hover {
    background: #f0f0f0;
    color: #000;
}

.panel-hint {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.panel-contador {
    display: block;
    font-size: 12px;
    color: #333;
    font-weight: 600;
}

.panel-lista {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px 14px;
    -webkit-overflow-scrolling: touch;
}

.panel-vacio {
    padding: 8px 2px 4px;
}

.panel-vacio-titulo {
    margin: 0 0 6px;
    font-weight: bold;
    font-size: 14px;
    color: #222;
}

.panel-vacio-msg {
    margin: 0 0 12px;
    font-size: 13px;
    color: #555;
    line-height: 1.4;
}

.panel-vacio-hint {
    margin: 12px 0 0;
    font-size: 12px;
    color: #888;
}

.panel-leyenda {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    color: #444;
}

.leyenda-item {
    margin: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.leyenda-sq {
    display: inline-block;
    width: 12px;
    height: 12px;
    background: #f1c40f;
    border: 1px solid #000;
    flex-shrink: 0;
}

.punto-resumen {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    padding: 8px 0 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.badge-punto {
    display: inline-block;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 10px;
    margin-bottom: 6px;
}

.badge-mio {
    background: #fef9e7;
    color: #9a7b0a;
    border: 1px solid #f1c40f;
}

.badge-ajeno {
    background: #eaf2f8;
    color: #1a5276;
    border: 1px solid #aed6f1;
}

.punto-resumen-titulo {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    line-height: 1.25;
    margin-bottom: 4px;
}

.punto-resumen-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.punto-header-text .btn-nota {
    margin-right: 6px;
}


#filtro-tipo-bar {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900; /* debajo del panel izquierdo cuando se superponen */
}

.btn-buscar {
    background: white;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #222;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-buscar:hover {
    background: #fafafa;
}

.btn-buscar-activo {
    background: #fef9e7;
    border-color: #f1c40f;
    color: #7d6608;
}

.buscar-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
    padding: 12px 14px;
    min-width: 220px;
    z-index: 1001;
}

.buscar-menu[hidden] {
    display: none !important;
}

.buscar-menu label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.buscar-menu select,
#filtro-tipo {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

#m-tipo,
#m-tipo-edit {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
}

@media (max-width: 720px) {
    #filtro-tipo-bar {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 900;
    }

    .btn-buscar {
        padding: 8px 14px;
        font-size: 12px;
    }

    .btn-user-menu {
        max-width: 140px;
        padding: 8px 10px 8px 8px;
    }

    .user-menu-name {
        max-width: 72px;
    }
}

.badge-tipo {
    display: inline-block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #1a5276;
    background: #eaf2f8;
    border: 1px solid #aed6f1;
    border-radius: 10px;
    padding: 2px 8px;
}

button.badge-tipo-btn {
    font: inherit;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: #1a5276;
    background: #eaf2f8;
    border: 1px solid #aed6f1;
    border-radius: 10px;
    padding: 2px 8px;
    margin-top: 4px;
}

button.badge-tipo-btn:hover {
    background: #d4e6f1;
    border-color: #5dade2;
}


.objeto-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin: 6px 0;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}

.objeto-info {
    flex: 1;
    font-size: 13px;
    line-height: 1.35;
    min-width: 0;
}

.objeto-acciones {
    display: flex;
    flex-shrink: 0;
    gap: 4px;
}

.btn-obj-act {
    border: 1px solid #ddd;
    background: #fafafa;
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 12px;
    cursor: pointer;
    line-height: 1.2;
}

.btn-obj-act:hover {
    background: #f0f0f0;
}

.btn-obj-act.activo {
    background: #fef9e7;
    border-color: #f1c40f;
}


.login-email-hint {
    font-size: 11px;
    color: #888;
    margin: -4px 0 10px;
    line-height: 1.35;
}


.login-forgot-wrap {
    margin: 12px 0 0;
    text-align: center;
}

.login-link-btn {
    background: none;
    border: none;
    color: #2980b9;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.login-link-btn:hover {
    color: #1a5276;
}

.auth-ok-msg {
    margin-top: 10px;
    font-size: 13px;
    color: #1e8449;
    line-height: 1.4;
}


.login-register-wrap {
    margin-top: 16px;
    text-align: center;
    font-size: 13px;
    color: #555;
}

.login-register-wrap .login-link-btn {
    margin-left: 4px;
}
